ELC in dev
ELC-lang
载入中...
搜索中...
未找到
all_defs.cpp
浏览该文件的文档.
1#line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
2//all
3//at namespace ::
4/*
5未完成的elc解释器include文件
6由steve02081504与Alex0125设计、编写
7转载时请在不对此文件做任何修改的同时注明出处
8项目地址:https://github.com/steve02081504/ELC
9*/
10//tool reg : \n[^\n]+\d+ (\S+)\n -> \n\t#include \"\1\"\n
11#if !defined(ELC_ALL)
12 #define ELC_ALL
13 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
14 //base
15 //at namespace ::
16 /*
17 未完成的elc解释器include文件
18 由steve02081504与Alex0125设计、编写
19 转载时请在不对此文件做任何修改的同时注明出处
20 项目地址:https://github.com/steve02081504/ELC
21 */
22 #if !defined(ELC_BASE)
23 #define ELC_BASE
24 //原base的一小部分,但由于过于底层,底层到API定义都需要使用。。
25 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
26 //base_defs
27 //at namespace ::
28 /*
29 未完成的elc解释器include文件
30 由steve02081504与Alex0125设计、编写
31 转载时请在不对此文件做任何修改的同时注明出处
32 项目地址:https://github.com/steve02081504/ELC
33 */
34 #if !defined(ELC_BASE_DEFS)
35 #define ELC_BASE_DEFS
36 #define __builtin_is_my_dick_still_there() true
37 #include <cstddef>//nullptr_t
38 #include <cstdlib>//exit、size_t
39 #include <new>//operator new(T*)、launder
40 #include <algorithm>//max、min
41 #include <type_traits>//enable_if等
42 #include <typeinfo>//RTTI
43 #include <cmath>//sqrt
44 #include <cfenv>//rounding
45 #include <ranges>
46 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
47 //_body.hpp
48 //at namespace ::
49 /*
50 未完成的elc解释器base_defs文件
51 由steve02081504与Alex0125设计、编写
52 转载时请在不对此文件做任何修改的同时注明出处
53 项目地址:https://github.com/steve02081504/ELC
54 */
55 //include default_data_type:基础数据类型定义
56 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
57 //default_data_type.hpp
58 /*
59 未完成的elc解释器_share文件
60 由steve02081504与Alex0125设计、编写
61 转载时请在不对此文件做任何修改的同时注明出处
62 项目地址:https://github.com/steve02081504/ELC
63 */
64 namespace elc{
65 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
66 typedef char32_t char_t;
67 /*ELC内部钦定int_t类型*/
68 typedef int64_t int_t;
69 /*ELC内部钦定uint_t类型*/
70 typedef uint64_t uint_t;
71 /*ELC内部钦定float_t类型*/
72 typedef double float_t;
73 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
74 typedef long double float_size_t;
75 }
76
77 //file_end
78
79 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
80 namespace elc::defs{ //在elc::defs中定义内容
81 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
82 //_defs.hpp
83 /*
84 未完成的elc解释器basic文件
85 由steve02081504与Alex0125设计、编写
86 转载时请在不对此文件做任何修改的同时注明出处
87 项目地址:https://github.com/steve02081504/ELC
88 */
89 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
90 //_defs.hpp
91 /*
92 未完成的elc解释器_share文件
93 由steve02081504与Alex0125设计、编写
94 转载时请在不对此文件做任何修改的同时注明出处
95 项目地址:https://github.com/steve02081504/ELC
96 */
97
98 //undefs at "_undefs.hpp"
99
100 //set ELC_WARNING_LEVEL default to 4(max)
101 #if !defined(ELC_WARNING_LEVEL)
102 #define ELC_WARNING_LEVEL 4
103 #endif
104
105 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
106 //basic_environment.hpp
107 /*
108 未完成的elc解释器_share文件
109 由steve02081504与Alex0125设计、编写
110 转载时请在不对此文件做任何修改的同时注明出处
111 项目地址:https://github.com/steve02081504/ELC
112 */
113
114 //每个bit(不是字节)的可能性
115 //为什么c艹委员会不定义这个?
116 #define BIT_POSSIBILITY 2
117
118 //file_end
119
120 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
121
122 #if defined(_MSC_VER)
123 #pragma warning(push,ELC_WARNING_LEVEL)
124 #pragma warning(disable:4099)//class与struct混用警告diss
125 #pragma warning(disable:26812)//enum class安利diss.
126 #pragma warning(disable:4584)//重复子类警告diss
127 #pragma warning(disable:4250)//域控制继承警告diss
128 #pragma warning(disable:26432)//不完全默认方法警告diss
129 #pragma warning(disable:26435)//virtual override方法警告diss
130 #pragma warning(disable:26481)//容器安利diss
131 #pragma warning(disable:26446)//gsl::at安利diss
132 #pragma warning(disable:26434)//方法覆盖警告diss
133 #pragma warning(disable:26429)//gsl::not_null安利diss
134 #pragma warning(disable:26471)//对void*进行static_cast安利diss
135 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
136 #pragma warning(disable:26473)//相同指针显式cast警告diss
137 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
138 #pragma warning(disable:26485)//数组作指针警告diss
139 #pragma warning(disable:26490)//reinterpret_cast警告diss
140 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
141 #pragma warning(disable:26482)//非常数数组索引警告diss
142 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
143 #endif
144 #if defined(_MSC_VER)
145 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
146 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
147 #define push_msvc_warning() __pragma(warning(push))
148 #define pop_msvc_warning() __pragma(warning(pop))
149 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
150 #else
151 #define suppress_msvc_warning(...)
152 #define disable_msvc_warning(...)
153 #define push_msvc_warning()
154 #define pop_msvc_warning()
155 #define push_and_disable_msvc_warning(...)
156 #endif
157 //
158 #if defined(ELC_VOID_NAME)
159 #undef void
160 #endif
161
162 // #define often_noexcept
163 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
164 #define noexcept_as_auto MAGIC//哦现在有了
165 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
166 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
167
168 #define using_method_from_base_t(name,...) \
169 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
170 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
171 {\
172 return base_t::name(forward<Args>(rest)...);\
173 }\
174
175 #define using_method_from_value(name,value_name,...) \
176 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
177 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
178 {\
179 return value_name.name(forward<Args>(rest)...);\
180 }\
181
182 #define floop while(__builtin_is_my_dick_still_there())
183 #define enable_adl(name) void name()noexcept=delete
184
185 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
186 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
187
188 #define declvalue(...) (::std::declval<__VA_ARGS__>())
189
190 /*实例化到此将引发错误*/
191 #define template_error(reason) static_assert(template_error_helper<T>,reason)
192 /*实例化到此将引发警告*/
193 #define template_warning(reason) template_warning_helper<T>(reason)
194
195 //for type_info
196 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
197 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
198
199 #define is_common_attribute(name) public attribute<T,name<T>>
200 #define is_special_attribute(name) public attribute<T,name>
201
202 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
203 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
204
205 //for float_size_t
206 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
207 //bitnum_of
208 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
209
210 //for attribute
211 #define def_common_attribute_with_nothing(name) \
212 template<typename T>\
213 class name{}\
214
215 #define def_special_attribute_with_nothing(name) \
216 class name{}\
217
218 #define common_attribute_t template<class>class
219 #define special_attribute_t class
220
221 /*
222 若参数的布尔值为零,那么此模板不会实例化
223
224 为什么不用cpp20的constraints?
225 1.不能类内定义
226 2.不能作为模板参数
227 一句话总结:c艹标准会sb
228 */
229 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
230 /*默认参与模板候选*/
231 #define enabled_by_default class enable_state=void
232 /*默认不参与模板候选*/
233 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
234 /*若参数为病式,那么此模板不会实例化*/
235 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
236 /*用于模板声明*/
237 #define enable_flag class enable_state
238
239 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
240 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
241 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
242 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
243 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
244
245 /*让lambda递归更加美观*/
246 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
247 /*让lambda递归更加美观*/
248 #define get_recursive_lambda_caller(name) \
249 lambda_with_catch(&)(auto&&...Args){\
250 return name(name,Args...);\
251 }
252 /*让lambda定义更加美观*/
253 #define lambda []
254 /*让lambda定义更加美观*/
255 #define lambda_with_catch(...) [__VA_ARGS__]
256 /*让lambda递归更加美观*/
257 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
258 //recursive_lambda_self_referential_reserved_symbolname
259 #define lambda_RLSRRS _my_jb_super_sb_name_
260
261 #define MAGIC//ahh,ko no tenno da!
262
263 /*装饰性语法糖*/
264 #define nothing
265
266 /*aya风格语法糖*/
267 #define elseif else if
268 /*aya风格语法糖*/
269 #define _big_than_ >
270 /*aya风格语法糖*/
271 #define _small_than_ <
272
273 #if defined(_MSC_VER)
274 #define not !
275 #define and &&
276 #define or ||
277 #endif
278
279 /*进入名称空间,并不是很美观*/
280 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
281 /*退出名称空间,并不是很美观*/
282 #define BREAK_NAMESPACE }
283
284 /*template说明符*/
285 #define template_name template
286 /*template说明符*/
287 #define type_name class
288
289 #if defined(DEBUG) || defined(_DEBUG)
290 #define not_in_debug 0
291 #else
292 #define not_in_debug 1
293 #endif
294
295 #define es U""
296 #define ec(ch) U ## ch
297
298 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
299 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
300 #else
301 #define ELC_TEST_EVENTNAME(name)
302 #endif
303
304 #define override_instance_struct \
305 protected:\
306 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
307 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
308 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
309 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
310 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
311
312 #if defined(_WIN32)
313 #define distinctive __declspec(dllexport)
314 #else
315 #define distinctive
316 #endif
317
318 #if defined(_WIN32)
319 #define force_inline __forceinline
320 #elif defined(__GNUC__)
321 #define force_inline __attribute__((always_inline)) inline
322 #else
323 #define force_inline inline
324 #endif
325
326 #if defined(_WIN32)
327 #define with_no_vtable __declspec(novtable)
328 #else
329 #define with_no_vtable
330 #endif
331
332 #define in_consteval (::std::is_constant_evaluated())
333
334 #define no_vtable_struct struct with_no_vtable
335 #define no_vtable_class class with_no_vtable
336
337 //file_end
338
339 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
340
341 //file_end
342
343 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
344
345 namespace base{}
346 using namespace base;//导出内容:defs内的名称空间只起到大体名称分组的作用,不进行名称阻拦
347
348 //内存泄露检测
349 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
350 namespace memory{
351 inline void check_memory_lack()noexcept;
352 inline struct distinctive memory_lack_checker_t{
353 ~memory_lack_checker_t(){
354 check_memory_lack();
355 }
356 }memory_lack_checker{};
357 }
358 #endif
359
360 namespace base{
361 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
362 //_body.hpp
363 //at namespace elc::defs::base
364 /*
365 未完成的elc解释器base_defs文件
366 由steve02081504与Alex0125设计、编写
367 转载时请在不对此文件做任何修改的同时注明出处
368 项目地址:https://github.com/steve02081504/ELC
369 */
370 //恭喜你找到elc内大部分语法糖所在地
371 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/template_helper.hpp"
372 //template_helper.hpp
373 //at namespace elc::defs::base
374 /*
375 未完成的elc解释器base_defs文件
376 由steve02081504与Alex0125设计、编写
377 转载时请在不对此文件做任何修改的同时注明出处
378 项目地址:https://github.com/steve02081504/ELC
379 */
380 /*
381 宏辅助,用以补全元编程错误宏template_error的内容.
382 */
383 template<class T>
384 constexpr bool template_error_helper=1000-7==114514;//w.
385 /*
386 宏辅助,用以补全元编程错误宏template_warning的内容.
387 */
388 template<class T,class U>
389 [[deprecated("this was a template warning."),nodiscard]]
390 inline auto template_warning_helper(U&&a)noexcept{return 0;}
391
392 //file_end
393
394 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
395 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/using_std.hpp"
396 //using_std.hpp
397 //at namespace elc::defs::base
398 /*
399 未完成的elc解释器base_defs文件
400 由steve02081504与Alex0125设计、编写
401 转载时请在不对此文件做任何修改的同时注明出处
402 项目地址:https://github.com/steve02081504/ELC
403 */
404 //从std中导入一些名称.
405 //这不比博人传燃?
406 using ::std::byte;
407 using ::std::size_t;
408
409 using ::std::forward;
410 using ::std::addressof;
411 using ::std::swap;
412 /*
413 如何不用中间变量swap两个值?
414 方法一:
415 a=a+b
416 b=a-b
417 a=a-b
418 方法二:
419 a^=b^=a^=b
420 道理我都懂,可是还是用中间变量快些
421 XD
422 更多方法欢迎补充
423 */
424
425 template<class T>
426 using remove_cvref= ::std::remove_cvref_t<T>;
427 template<class T>
428 using remove_cv= ::std::remove_cv_t<T>;
429 template<class T>
430 using remove_ref= ::std::remove_reference_t<T>;
431 template<bool B,class T,class F>
432 using conditional= ::std::conditional_t<B,T,F>;
433 //
434 using ::std::partial_ordering;
435 using ::std::weak_ordering;
436 using ::std::strong_ordering;
437
438 //file_end
439
440 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
441 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/concept.hpp"
442 //concept.hpp
443 //at namespace elc::defs::base
444 /*
445 未完成的elc解释器base_defs文件
446 由steve02081504与Alex0125设计、编写
447 转载时请在不对此文件做任何修改的同时注明出处
448 项目地址:https://github.com/steve02081504/ELC
449 */
450 //template<typename T,template<typename>constexpr bool name>
451 //concept as_concept=name<T>;
452
453 //file_end
454
455 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
456 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/magic_number.hpp"
457 //magic_number.hpp
458 //at namespace elc::defs::base
459 /*
460 未完成的elc解释器base_defs文件
461 由steve02081504与Alex0125设计、编写
462 转载时请在不对此文件做任何修改的同时注明出处
463 项目地址:https://github.com/steve02081504/ELC
464 */
465 namespace magic_number{
466 /*
467 黄金分割比
468 数理逻辑不应通过强奸感性来定义审美.
469 我们应当遵从物体的自身结构,辅助线仅能在这基础上起到梳理作用,并不能以此作为创作起点来表达情感,它仅存于外部世界,无法到达内心.
470 黄金分割并不万能.
471 */
472 constexpr auto gold=0.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408807538689175212663386222353693179318006076672635443338908659593958290563832266131992829026788067520876689250171169620703222104321626954862629631361443814975870122034080588795445474924618569536486444924104432077134494704956584678850987433944221254487706647809158846074998871240076521705751797883416625624940758906970400028121042762177111777805315317141011704666599146697987317613560067087480710131795236894275219484353056783002287856997829778347845878228911097625003026961561700250464338243776486102838312683303724292675263116533924731671112115881863851331620384005222165791286675294654906811317159934323597349498509040947621322298101726107059611645629909816290555208524790352406020172799747175342777592778625619432082750513121815628551222480939471234145170223735805772786160086883829523045926478780178899219902707769038953219681986151437803149974110692608867429622675756052317277752035361393621076738937645560606059216589466759551900400555908950229530942312482355212212415444006470340565734797663972394949946584578873039623090375033993856210242369025138680414577995698122445747178034173126453220416397232134044449487302315417676893752103068737880344170093954409627955898678723209512426893557309704509595684401755519881921802064052905518934947592600734852282101088194644544222318891319294689622002301443770269923007803085261180754519288770502109684249362713592518760777884665836150238913493333122310533923213624319263728910670503399282265263556209029798642472759772565508615487543574826471814145127000602389016207773224499435308899909501680328112194320481964387675863314798571911397815397807476150772211750826945863932045652098969855567814106968372884058746103378105444390943683583581381131168993855576975484149144534150912954070050194775486163075422641729394680367319805861833918328599130396072014455950449779212076124785645916160837059498786006970189409886400764436170933417270919143365013715;//精度2000(然而只是double而已.)
473
474 /*每次扩容后的空间与原空间为这样的比值可以最小化时空负担,是的,以一种较为艺术的比值.*/
475 constexpr auto gold_of_resize=gold+1;//精度2000——大概
476
477 /*圆周率.*/
478 constexpr auto pi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009;//精度2000
479
480 /*自然对数的底数.*/
481 constexpr auto e = 2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319525101901157383418793070215408914993488416750924476146066808226480016847741185374234544243710753907774499206955170276183860626133138458300075204493382656029760673711320070932870912744374704723069697720931014169283681902551510865746377211125238978442505695369677078544996996794686445490598793163688923009879312773617821542499922957635148220826989519366803318252886939849646510582093923982948879332036250944311730123819706841614039701983767932068328237646480429531180232878250981945581530175671736133206981125099618188159304169035159888851934580727386673858942287922849989208680582574927961048419844436346324496848756023362482704197862320900216099023530436994184914631409343173814364054625315209618369088870701676839642437814059271456354906130310720851038375051011574770417189861068739696552126715468895703503540212340784981933432106817012100562788023519303322474501585390473041995777709350366041699732972508868769664035557071622684471625607988265178713419512466520198918006308407507245458379639351364421067750539471789004518357551541252235905906872648786357525419112888773717663748602766063496035367947026923229718683277173932361920077745221262475186983349515101986426988784717193966497690708252174233656627259284406204302141137199227852699846988477023238238400556555178890876613601304770984386116870523105531491625172837327286760072481729876375698163354150746088386636406934704372066886512756882661497307886570156850169186474885416791545965072342877306998537139043002665307839877638503238182155355973235306860430106757608389086270498418885951380910304235957824951439885901131858358406674723702971497850841458530857813391562707603563907639473114554958322669457024941398316343323789759556808568362972538679132750555425244919435891284050452269538121791319145135009938463117740179715122837854601160359554028644059;//精度2000
482
483 constexpr auto god=72;//神已死,神万岁.
484
485 /*符号位查询*/
486 template<typename T> requires ::std::is_arithmetic_v<T>
487 [[nodiscard]]force_inline constexpr bool is_negative(T x)noexcept{
488 if constexpr(::std::is_signed_v<T>){
489 if constexpr(::std::is_floating_point_v<T>)
490 return ::std::signbit(x);
491 else
492 return x<0;
493 }
494 else
495 return false;
496 }
497 /*符号位设置*/
498 template<typename T> requires ::std::is_arithmetic_v<T>
499 [[nodiscard]]force_inline constexpr T copy_as_negative(auto x,bool negative=1)noexcept{
500 if constexpr(::std::is_signed_v<decltype(x)>){
501 if constexpr(::std::is_floating_point_v<decltype(x)>)
502 return(T)::std::copysign(x,negative?-1:1);
503 else
504 return(T)negative?T{}-x:x;
505 }
506 else
507 return x;
508 }
509 [[nodiscard]]force_inline constexpr auto copy_as_negative(auto x,bool negative=1)noexcept{
510 return copy_as_negative<decltype(x)>(x,negative);
511 }
512 /*任意算数类型转size_t*/
513 template<typename T> requires ::std::is_arithmetic_v<T>
514 [[nodiscard]]force_inline constexpr size_t to_size_t(T x)noexcept{
515 if constexpr(::std::is_floating_point_v<T>)
516 return (size_t)(ptrdiff_t)x;
517 else
518 return (size_t)x;
519 }
520 /*任意算数类型转uintmax_t*/
521 template<typename T> requires ::std::is_arithmetic_v<T>
522 [[nodiscard]]force_inline constexpr ::std::uintmax_t to_uintmax_t(T x)noexcept{
523 if constexpr(::std::is_floating_point_v<T>)
524 return (::std::uintmax_t)(::std::intmax_t)x;
525 else
526 return (::std::uintmax_t)x;
527 }
528 /*求余*/
529 template<typename T1,typename T2> requires ::std::is_arithmetic_v<T1> and ::std::is_arithmetic_v<T2>
530 [[nodiscard]]force_inline constexpr auto mod(T1 a,T2 b){
531 if constexpr(::std::is_floating_point_v<T1>||::std::is_floating_point_v<T2>)
532 return ::std::fmod(a,b);
533 else
534 return a%b;
535 }
536 /*设置浮点舍入*/
537 template<typename T>
538 [[nodiscard]]force_inline constexpr void set_rounding(int mode){
539 if constexpr(::std::is_floating_point_v<T>)
540 ::std::fesetround(mode);
541 }
542 /*获取浮点舍入*/
543 template<typename T>
544 [[nodiscard]]force_inline constexpr int get_rounding(){
545 if constexpr(::std::is_floating_point_v<T>)
546 return ::std::fegetround();
547 else
548 return 0;
549 }
550 /*设置并自动恢复浮点舍入*/
551 template<typename T>
554 rounding_auto_setter(int new_rounding){
555 old_rounding=get_rounding<T>();
556 set_rounding<T>(new_rounding);
557 }
559 set_rounding<T>(old_rounding);
560 }
561 };
562 //位操作:循环左移(无mod)
563 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
564 template<class T> requires ::std::is_unsigned_v<T>
565 [[nodiscard]]force_inline constexpr auto rotl_nomod(const T v,const auto R)noexcept;
566 //位操作:循环右移(无mod)
567 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
568 template<class T> requires ::std::is_unsigned_v<T>
569 [[nodiscard]]force_inline constexpr auto rotr_nomod(const T v,const auto r)noexcept{
570 constexpr auto d = ::std::numeric_limits<T>::digits;
571 if constexpr(::std::is_unsigned_v<decltype(r)>){
572 if(r)
573 return static_cast<T>(static_cast<T>(v >> r) | static_cast<T>(v << (d - r)));
574 else
575 return v;
576 }
577 else{
578 if(r>0)
579 return static_cast<T>(static_cast<T>(v >> r) | static_cast<T>(v << (d - r)));
580 elseif(r==0)
581 return v;
582 else//r<0
583 return rotl_nomod(v,0-r);
584 }
585 }
586 //位操作:循环左移(无mod)
587 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
588 template<class T> requires ::std::is_unsigned_v<T>
589 [[nodiscard]]force_inline constexpr auto rotl_nomod(const T v,const auto r)noexcept{
590 constexpr auto d = ::std::numeric_limits<T>::digits;
591 if constexpr(::std::is_unsigned_v<decltype(r)>){
592 if(r)
593 return static_cast<T>(static_cast<T>(v << r) | static_cast<T>(v >> (d - r)));
594 else
595 return v;
596 }
597 else{
598 if(r>0)
599 return static_cast<T>(static_cast<T>(v << r) | static_cast<T>(v >> (d - r)));
600 elseif(r==0)
601 return v;
602 else//r<0
603 return rotr_nomod(v,0-r);
604 }
605 }
606 //位操作:循环右移
607 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
608 template<class T> requires ::std::is_unsigned_v<T>
609 [[nodiscard]]force_inline constexpr auto rotr(const T v,const auto R)noexcept{
610 constexpr auto d = ::std::numeric_limits<T>::digits;
611 const auto r = mod(R,d);
612 return rotr_nomod(v,r);
613 }
614 //位操作:循环左移
615 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
616 template<class T> requires ::std::is_unsigned_v<T>
617 [[nodiscard]]force_inline constexpr auto rotl(const T v,const auto R)noexcept{
618 constexpr auto d = ::std::numeric_limits<T>::digits;
619 const auto r = mod(R,d);
620 return rotl_nomod(v,r);
621 }
622 template<class T> requires ::std::is_arithmetic_v<T>
624 static constexpr auto rot_offset_npos = ::std::numeric_limits<T>::digits;//d
625 size_t _offset;
626 public:
627 force_inline constexpr rot_iterator(size_t offset)noexcept:_offset(offset%rot_offset_npos){}
629 _offset++;
630 if(_offset==rot_offset_npos)
631 _offset=0;
632 return*this;
633 }
635 if(_offset==0)
636 _offset=rot_offset_npos;
637 _offset--;
638 return*this;
639 }
640 force_inline constexpr rot_iterator operator++(int)noexcept{
641 rot_iterator tmp(*this);
642 operator++();
643 return tmp;
644 }
645 force_inline constexpr rot_iterator operator--(int)noexcept{
646 rot_iterator tmp(*this);
647 operator--();
648 return tmp;
649 }
650 [[nodiscard]]force_inline constexpr size_t value()const noexcept{
651 return _offset;
652 }
653 };
654 //位操作:循环左移(无mod)
655 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
656 template<class T> requires ::std::is_unsigned_v<T>
657 [[nodiscard]]force_inline constexpr auto rotl_nomod(const T v,const rot_iterator<T>&r)noexcept{
658 return rotl_nomod(v,r.value());
659 }
660 //位操作:循环右移(无mod)
661 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
662 template<class T> requires ::std::is_unsigned_v<T>
663 [[nodiscard]]force_inline constexpr auto rotr_nomod(const T v,const rot_iterator<T>&r)noexcept{
664 return rotr_nomod(v,r.value());
665 }
666 //位操作:循环左移
667 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
668 template<class T> requires ::std::is_unsigned_v<T>
669 [[nodiscard]]force_inline constexpr auto rotl(const T v,const rot_iterator<T>&r)noexcept{
670 return rotl_nomod(v,r);
671 }
672 //位操作:循环右移
673 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
674 template<class T> requires ::std::is_unsigned_v<T>
675 [[nodiscard]]force_inline constexpr auto rotr(const T v,const rot_iterator<T>&r)noexcept{
676 return rotr_nomod(v,r);
677 }
678 //abs
679 template<class T> requires ::std::is_arithmetic_v<T>
680 [[nodiscard]]force_inline constexpr auto abs(const T v)noexcept{
681 if constexpr(::std::is_signed_v<T>)
682 return v>=0?v:-v;
683 else
684 return v;
685 }
686 //feq
687 template<class T> requires ::std::is_arithmetic_v<T>
688 [[nodiscard]]force_inline constexpr bool feq(const T a,const T b)noexcept{
689 return abs(a-b)<=::std::numeric_limits<T>::epsilon();
690 }
691 //sub
692 template<class T1,class T2> requires was_not_an_ill_form(declvalue(T1)-declvalue(T2))
693 [[nodiscard]]force_inline constexpr auto sub(const T1 a,const T2 b)noexcept{
694 if constexpr(::std::is_arithmetic_v<T1>&&::std::is_arithmetic_v<T2>){
695 if constexpr(::std::is_floating_point_v<T1>||::std::is_floating_point_v<T2>)
696 return a-b;
697 else{
698 using signedT = ::std::make_signed_t<::std::common_type_t<T1,T2>>;
699 return static_cast<signedT>(a)-static_cast<signedT>(b);
700 }
701 }
702 else
703 return a-b;
704 }
705 //exp
706 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
707 template<class T> requires ::std::is_floating_point_v<T>
708 [[nodiscard]]force_inline constexpr T exp(const T v)noexcept{
709 if in_consteval{
710 typedef decltype(::std::exp(v)) RT;
711 auto exp_impl = recursive_lambda(RT x,RT sum,RT n,size_t i,RT t)noexcept -> RT{
712 const auto epsilon=sum+t/n;
713 if(feq(sum,epsilon))
714 return sum;
715 else
716 return self_recursion(x,epsilon,n*i,i+1,t*x);
717 };
718 auto exp_impl_caller = get_recursive_lambda_caller(exp_impl);
719 return exp_impl_caller(RT{v},RT{1},RT{1},2,RT{v});
720 }
721 else
722 return ::std::exp(v);
723 }
724 //log
725 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
726 template<class T> requires ::std::is_arithmetic_v<T>
727 [[nodiscard]]force_inline constexpr auto log(const T a)noexcept{
728 if in_consteval{
729 typedef decltype(::std::log(a)) RT;
730 auto log_impl = recursive_lambda(const RT x,const RT y)noexcept -> RT{
731 auto log_iter = lambda(RT x,RT y)noexcept{
732 const auto exp_y = exp(y);
733 return y + T{2}*(x-exp_y)/(x+exp_y);
734 };
735 return RT(feq(y,log_iter(x,y)) ? y : self_recursion(x,log_iter(x,y)));
736 };
737 auto log_impl_caller = get_recursive_lambda_caller(log_impl);
738 return log_impl_caller((RT)a,RT{0});
739 }
740 else
741 return ::std::log(a);
742 }
743 template<class T,class U> requires ::std::is_arithmetic_v<T> && ::std::is_arithmetic_v<U>
744 [[nodiscard]]force_inline constexpr auto log(const T a,const U b)noexcept{
745 return log(a)/log(b);
746 }
747 //pow
748 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
749 template<class T,class U> requires (::std::is_arithmetic_v<T> && ::std::is_arithmetic_v<U>)
750 [[nodiscard]]force_inline constexpr auto pow(const T a,const U b)noexcept{
751 if in_consteval{
752 typedef decltype(::std::pow(a,b)) RT;
753 return exp(RT(b)*log(RT(a)));
754 }
755 else
756 return ::std::pow(a,b);
757 }
758 //trunc
759 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
760 template<class T> requires ::std::is_floating_point_v<T>
761 [[nodiscard]]force_inline constexpr auto trunc(const T v)noexcept{
762 if in_consteval{
763 typedef decltype(::std::trunc(v)) RT;
764 return static_cast<RT>((::std::intmax_t)v);
765 }
766 else
767 return ::std::trunc(v);
768 }
769 //ceil
770 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
771 template<class T> requires ::std::is_floating_point_v<T>
772 [[nodiscard]]force_inline constexpr auto ceil(const T v)noexcept{
773 if in_consteval{
774 typedef decltype(::std::ceil(v)) RT;
775 auto ceil_impl = lambda(T x, T y)noexcept{
776 return feq(x,y) ? y : y+T{1};
777 };
778 return v<0 ? -static_cast<T>(to_uintmax_t(-v)) : ceil_impl(v,static_cast<T>(to_uintmax_t(v)));
779 }
780 else
781 return ::std::ceil(v);
782 }
783
784 /*判断某数是否是素数*/
785 template<class T> requires ::std::is_arithmetic_v<T>
786 [[nodiscard]]inline constexpr bool is_prime_num(T a)
787 {
788 if constexpr(::std::is_floating_point_v<T>)
789 if(a != ceil(a))
790 return false;
791 /*
792 应某人的要求补注释(都是主人的任务罢了.).
793 */
794 a=abs(a);
795
796 if(a<4)
797 return true;//1和0也是prime,我不管.
798 /*
799 当x≥1,那么≥5的自然数如下:
800 6x-1 6x 6x+1 6x+2 6x+3 6x+4
801 6(x+1)-1 6(x+1) 6(x+1)+1 ... //这已经是下一周期了.
802
803 考虑单个周期:
804 6x+2 6x+3 6x+4 是 2(3x+1) 3(2x+1) 2(3x+2),排除.
805 6x,排除.
806 那么,只用考虑6x±1是否是prime.
807 */
808 if(mod(mod(a,6)-1,4))
809 return false;
810 T b=static_cast<T>(::std::sqrt(a));//若一个数可以分解为两因数之积,其中一个因数必定≤其开方:反指数式减少遍历范围.
811 /*
812 接下来:
813 设要判定的数n(6x±1的缩写).
814 测试数可以看为6i-1 6i 6i+1 6i+2 6i+3 6i+4的其中之一,同样以6为周期.
815 对于测试数的整个周期,其中:
816 如果n能被6i 6i+2 6i+4整除:则n要是偶数,但±1,排除.
817 如果n能被6i+3整除:则n要是3倍数,但±1,排除.
818 综上,循环中只要考虑6i±1的情况.
819 所以以5起始,前进6(自然选择号,前进4!),逐次判断0与+2.
820 虽然很想写成以6为起始逐次判断±1的对称格式但是这样会加重时空负担.(不甘心.....)
821 */
822 for(T c=5;c<=b;c+=6)//遍历判断是否能被因数分解——不会有人看不懂吧?
823 if((!mod(a,c))||(!mod(a,(c+2))))
824 return false;
825 /*
826 最后,为什么是6?
827 就结论来说,此数值选择最常出现的两因数(除0或1外.)之积可以最大程度减少时间占用.
828 所以虽然更喜欢7/8/9之类的数不过使用6收益最大.
829 要不是这样早就写成7了.
830 */
831 return true;
832 /*
833 因为后半段判定没有考虑到≤5的数,所以本函数第一个if进行判定补全.
834 */
835 }
836 //求大于某数的素数
837 template<class T> requires ::std::is_arithmetic_v<T>
838 [[nodiscard]]inline constexpr T get_prime_num_big_or_eq_than(T a){
839 if constexpr(::std::is_floating_point_v<T>)
840 a=ceil(a);
841 while(!is_prime_num(a))
842 a++;
843 return a;
844 }
845 push_and_disable_msvc_warning(26467);//gold_of_resize永远为正数
846 //已知当前array的size,求下一个合适的提前分配大小
847 [[nodiscard]]inline constexpr size_t get_next_gold_size_to_resize_for_array(size_t size){
848 /*
849 每次扩容后的空间与原空间比大致为gold of resize可以最小化时空负担.
850 */
851 return size_t(size*gold_of_resize);
852 }
853 //已知当前hash table的size,求下一个合适的桶大小
854 [[nodiscard]]inline constexpr size_t get_next_gold_size_to_resize_for_hash(size_t size){
855 /*
856 素数大小的桶数可以使hash table中的每个桶尽可能活跃.
857 每次扩容后的空间与原空间比大致为gold of resize可以最小化时空负担.
858 */
859 return size_t(get_prime_num_big_or_eq_than(size*gold_of_resize));
860 }
862
863 //线性插值.
864 namespace linear_interpolation{
865 [[nodiscard]]inline constexpr auto get_k(auto y1,auto y2,auto δx)noexcept{
866 auto δy=sub(y2,y1);
867 auto k=δy/δx;
868 return k;
869 }
870 [[nodiscard]]inline constexpr auto get_k(auto y1,auto y2)noexcept{
871 return get_k(y1,y2,1.0);
872 }
873 [[nodiscard]]inline constexpr auto get_result(auto y1,auto k,auto δx)noexcept{
874 auto diff=k*δx;
875 return y1+diff;
876 }
877 [[nodiscard]]inline constexpr auto get_reverse_result(auto k,auto δx,auto y)noexcept{
878 auto diff=k*δx;
879 return y-diff;
880 }
881 }
882 }
886 using magic_number::mod;
890 using magic_number::rotl;
891 using magic_number::rotr;
895 using magic_number::abs;
896 using magic_number::exp;
897 using magic_number::log;
898 using magic_number::pow;
899 using magic_number::ceil;
903
904 //file_end
905
906 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
907
908 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/other.hpp"
909 //other.hpp
910 //at namespace elc::defs::base
911 /*
912 未完成的elc解释器base_defs文件
913 由steve02081504与Alex0125设计、编写
914 转载时请在不对此文件做任何修改的同时注明出处
915 项目地址:https://github.com/steve02081504/ELC
916 */
917 class empty_type{};
918
919 template<typename T,typename U>
920 inline auto&assign(T&&a,U&&b)noexcept_as(a=b){//为绕过条件内赋值时の警告而使用
921 a=b;
922 return a;
923 }
924
925 template<typename T>
926 inline void discard(T&&){}//fucking nodiscard.
927 template<typename T>
928 inline void just_a_use(T&&){}
929
930 template<typename T>
932
934 template<typename T>
935 static void destroy(T*a)noexcept{
936 if constexpr(was_not_an_ill_form(the_destroy(a)))
937 the_destroy(a);
938 else
939 template_error("Please overload the function the_destroy in the namespace where this type is defined.");
940 }
941
942 //file_end
943
944 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
945
946 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/cast.hpp"
947 //cast.hpp
948 //at namespace elc::defs::base
949 /*
950 未完成的elc解释器base_defs文件
951 由steve02081504与Alex0125设计、编写
952 转载时请在不对此文件做任何修改的同时注明出处
953 项目地址:https://github.com/steve02081504/ELC
954 */
956 26491//down_cast警告diss
957 26466//down_cast警告diss
958 26492//const_cast警告diss
959 );
960 //对值追加const
961 template<typename T>
962 inline constexpr const T add_const(T a)noexcept{return a;}
963 //对引用追加const
964 template<typename T>
965 inline constexpr const T&add_const(T&a)noexcept{return a;}
966 //对引用移除const
967 template<typename T>
968 inline constexpr T&remove_const(const T&a)noexcept{return const_cast<T&>(a);}
969 //对指针追加const
970 template<typename T>
971 inline constexpr const T*add_const(T*a)noexcept{return a;}
972 //对指针移除const
973 template<typename T>
974 inline constexpr T*remove_const(const T*a)noexcept{return ::std::launder(const_cast<T*>(a));}
975 //向下转型至
976 template<typename T,typename U>
977 inline constexpr T down_cast(U a)noexcept{return static_cast<T>(a);}
979
980 //file_end
981
982 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
983 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/special_flags.hpp"
984 //special_flag.hpp
985 //at namespace elc::defs::base
986 /*
987 未完成的elc解释器base_defs文件
988 由steve02081504与Alex0125设计、编写
989 转载时请在不对此文件做任何修改的同时注明出处
990 项目地址:https://github.com/steve02081504/ELC
991 */
992
993 #define defspecflag(name)\
994 constexpr struct name##_t{} name{}
995
998
999 #undef defspecflag
1000
1001 //file_end
1002
1003 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1004 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/non_Xable.hpp"
1005 //non_Xable.hpp
1006 //at namespace elc::defs::base
1007 /*
1008 未完成的elc解释器base_defs文件
1009 由steve02081504与Alex0125设计、编写
1010 转载时请在不对此文件做任何修改的同时注明出处
1011 项目地址:https://github.com/steve02081504/ELC
1012 */
1014 constexpr non_copy_assign_able()noexcept=default;
1015 constexpr non_copy_assign_able(const non_copy_assign_able&)noexcept=default;
1016 constexpr non_copy_assign_able(non_copy_assign_able&&)noexcept=default;
1017 constexpr non_copy_assign_able& operator=(const non_copy_assign_able&)&noexcept=delete;
1018 constexpr non_copy_assign_able& operator=(non_copy_assign_able&&)&noexcept=default;
1019 };
1021 constexpr non_move_assign_able()noexcept=default;
1022 constexpr non_move_assign_able(const non_move_assign_able&)noexcept=default;
1023 constexpr non_move_assign_able(non_move_assign_able&&)noexcept=default;
1024 constexpr non_move_assign_able& operator=(const non_move_assign_able&)&noexcept=default;
1025 constexpr non_move_assign_able& operator=(non_move_assign_able&&)&noexcept=delete;
1026 };
1027
1029
1031 constexpr non_copy_construct_able()=default;
1034 };
1036 constexpr non_move_construct_able()=default;
1039 };
1040
1042 constexpr non_default_construct_able()=delete;
1043 };
1044
1047
1048 //file_end
1049
1050 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1051 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/attribute.hpp"
1052 //attribute.hpp
1053 //at namespace elc::defs::base
1054 /*
1055 未完成的elc解释器base_defs文件
1056 由steve02081504与Alex0125设计、编写
1057 转载时请在不对此文件做任何修改的同时注明出处
1058 项目地址:https://github.com/steve02081504/ELC
1059 */
1060 template<class T,typename attribute_name>
1062 protected:
1063 template<class U,special_attribute_t another_attribute_name>
1065 constexpr T*get_handle()noexcept{return down_cast<T*>(down_cast<attribute_name*>(this));}
1066
1067 template<class U,special_attribute_t another_attribute_name>
1068 friend const U*get_handle(const attribute<U,another_attribute_name>*)noexcept;
1069 constexpr const T*get_handle()const noexcept{return down_cast<const T*>(down_cast<const attribute_name*>(this));}
1070 };
1071 template<class T,special_attribute_t attribute_name>
1072 T*get_handle(attribute<T,attribute_name>*a)noexcept{return a->get_handle();}
1073 template<class T,special_attribute_t attribute_name>
1074 const T*get_handle(const attribute<T,attribute_name>*a)noexcept{return a->get_handle();}
1075
1076 template<class T,common_attribute_t attribute_name>
1077 T* get_handle(attribute<T,attribute_name<T>>*a)noexcept{return get_handle<T,attribute_name<T>>(a);}
1078 template<class T,common_attribute_t attribute_name>
1079 const T* get_handle(const attribute<T,attribute_name<T>>*a)noexcept{return get_handle<T,attribute_name<T>>(a);}
1080
1081 template<special_attribute_t attribute_name,class T>
1082 auto attribute_ptr_cast(T*ptr)noexcept{
1083 return static_cast<attribute_name*>(ptr);
1084 }
1085 template<special_attribute_t attribute_name,class T>
1086 auto attribute_ptr_cast(const T* ptr)noexcept{
1087 return static_cast<const attribute_name*>(ptr);
1088 }
1089 template<common_attribute_t attribute_name,class T>
1090 auto attribute_ptr_cast(T*ptr)noexcept{
1091 return attribute_ptr_cast<attribute_name<remove_cvref<T>>>(ptr);
1092 }
1093
1094 template<special_attribute_t attribute_name,class T>
1095 auto& attribute_cast(T&t)noexcept{
1096 return*attribute_ptr_cast<attribute_name>(&t);
1097 }
1098 template<common_attribute_t attribute_name,class T>
1099 auto& attribute_cast(T&t)noexcept{
1100 return*attribute_ptr_cast<attribute_name>(&t);
1101 }
1102
1103 template<special_attribute_t... attribute_names>
1104 struct special_attribute_pack:virtual attribute_names...{
1105 /*兼容用*/
1106 template<class T>
1107 struct on_type:special_attribute_pack<attribute_names>...{};
1108 };
1109 template<common_attribute_t... attribute_names>
1111 template<class T>
1112 struct on_type:attribute_names<T>...{};
1113 };
1114
1115 //file_end
1116
1117 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1118 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/special_attribute.hpp"
1119 //special_attribute.hpp
1120 //at namespace elc::defs::base
1121 /*
1122 未完成的elc解释器base_defs文件
1123 由steve02081504与Alex0125设计、编写
1124 转载时请在不对此文件做任何修改的同时注明出处
1125 项目地址:https://github.com/steve02081504/ELC
1126 */
1129
1130 //file_end
1131
1132 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1133 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/type_info.hpp"
1134 //type_info.hpp
1135 //at namespace elc::defs::base
1136 /*
1137 未完成的elc解释器base_defs文件
1138 由steve02081504与Alex0125设计、编写
1139 转载时请在不对此文件做任何修改的同时注明出处
1140 项目地址:https://github.com/steve02081504/ELC
1141 */
1142 struct type_name_t;//自动重整类型名并在析构时释放重整结果,对于gcc和clang的傻逼实现
1144 private:
1145 struct type_id_t{
1146 const ::std::type_info* _m;
1147
1148 constexpr type_id_t(const ::std::type_info&a)noexcept:_m(&a){}
1149 constexpr type_id_t(const type_id_t&a)noexcept=default;
1150 [[nodiscard]]type_name_t get_name()const noexcept;//定义于type_name.hpp
1151 [[nodiscard]]size_t get_hash()const noexcept{
1152 return _m->hash_code();
1153 }
1154 [[nodiscard]]bool operator==(const type_id_t&a)const noexcept{return *_m==*a._m;}
1155 };
1156
1157 type_id_t _tid;
1158 public:
1159 constexpr base_type_info_t(const ::std::type_info&a)noexcept:_tid(a){}
1160 constexpr base_type_info_t(const base_type_info_t&)noexcept=default;
1161 [[nodiscard]]type_name_t get_name()const noexcept;//定义于type_name.hpp
1162 [[nodiscard]]size_t get_hash()const noexcept{
1163 return _tid.get_hash();
1164 }
1165 [[nodiscard]]bool operator==(const base_type_info_t&a)const noexcept{return _tid==a._tid;}
1166 [[nodiscard]]bool operator==(const ::std::type_info&a)const noexcept{return _tid==type_id_t(a);}
1167 };
1168 template<class T>
1170 typedef T type;
1171
1172 template<class U>
1173 static constexpr bool same_as=::std::is_same_v<T,U>;
1174 template<class U>
1175 static constexpr bool not_same_as=!same_as<U>;
1176 template<class U>
1177 static constexpr bool base_on=::std::is_convertible_v<remove_cvref<T>*,remove_cvref<U>*>;
1178 template<class U>
1179 static constexpr bool not_base_on=!base_on<U>;
1180
1181 template<class U>
1182 static constexpr bool can_convert_to=::std::is_convertible_v<T,U>;
1183 template<class U>
1184 static constexpr bool can_t_convert_to=!can_convert_to<U>;
1185 template<class U>
1186 static constexpr bool can_nothrow_convert_to=::std::is_nothrow_convertible_v<T,U>;
1187 template<class U>
1188 static constexpr bool can_t_nothrow_convert_to=!can_nothrow_convert_to<U>;
1189
1190 /*
1191 //没有重载变量模板一说
1192 template<typename attribute_name>
1193 static constexpr bool has_attribute=has_attribute_helper<attribute_name>();
1194 template<typename attribute_name>
1195 static constexpr bool not_has_attribute=!has_attribute(attribute_name);
1196 */
1197 template<special_attribute_t attribute_name>
1198 static constexpr bool has_attribute_helper(){
1199 return base_on<attribute_name>;
1200 }
1201 template<common_attribute_t attribute_name>
1202 static constexpr bool has_attribute_helper(){
1203 return has_attribute_helper<attribute_name<remove_cvref<T>>>();
1204 }
1205 template<special_attribute_t attribute_name>
1206 static constexpr bool not_has_has_attribute_helper(){
1207 return!has_attribute_helper<attribute_name>();
1208 }
1209 template<common_attribute_t attribute_name>
1210 static constexpr bool not_has_has_attribute_helper(){
1211 return!has_attribute_helper<attribute_name>();
1212 }
1213
1214 // defed at defs.
1215 // #define has_attribute(...) has_attribute_helper<__VA_ARGS__>()
1216 // #define not_has_attribute(...) not_has_has_attribute_helper<__VA_ARGS__>()
1217
1218 template<common_attribute_t... common_attribute_names>
1219 struct with_common_attribute:common_attribute_pack<common_attribute_names...>::template_name on_type<T>{
1220 template<special_attribute_t... special_attribute_names>
1222 common_attribute_pack<common_attribute_names...>::template_name on_type<T>,
1223 special_attribute_pack<special_attribute_names...>::template_name on_type<T>
1224 {};
1225 };
1226 template<special_attribute_t... special_attribute_names>
1227 struct with_special_attribute:special_attribute_pack<special_attribute_names...>::template_name on_type<T>{
1228 template<common_attribute_t... common_attribute_names>
1230 special_attribute_pack<special_attribute_names...>::template_name on_type<T>,
1231 common_attribute_pack<common_attribute_names...>::template_name on_type<T>
1232 {};
1233 };
1234
1235 constexpr type_info_t()noexcept{}
1236 constexpr type_info_t(const type_info_t&)noexcept=default;
1237 [[nodiscard]]constexpr operator base_type_info_t()const noexcept{return base_type_info_t(typeid(T));}
1238 [[nodiscard]]constexpr bool operator==(const ::std::type_info&a)const noexcept{return base_type_info_t(*this)==base_type_info_t(a);}
1239 [[nodiscard]]type_name_t get_name()const noexcept;//定义于type_name.hpp
1240 [[nodiscard]]size_t get_hash()const noexcept{
1241 return base_type_info_t(*this).get_hash();
1242 }
1243 };
1244
1245 template<class T>
1247
1248 template<class T>
1249 [[nodiscard]]constexpr bool operator==(const type_info_t<T>&,const type_info_t<T>&){return true;}
1250 template<class T,class U>
1251 [[nodiscard]]constexpr bool operator==(const type_info_t<T>&,const type_info_t<U>&){return false;}
1252
1253 /*
1254 template<class T,class U>
1255 consteval auto operator?:(auto a,const type_info_t<T>&b,const type_info_t<U>&c){
1256 if(a)
1257 return b;
1258 else
1259 if(!a)
1260 return c;
1261 else
1262 return b && c;
1263 else
1264 return void();
1265 }
1266 */
1267
1268 //file_end
1269
1270 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1271 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/min_max.hpp"
1272 //min_max.hpp
1273 //at namespace elc::defs::base
1274 /*
1275 未完成的elc解释器base_defs文件
1276 由steve02081504与Alex0125设计、编写
1277 转载时请在不对此文件做任何修改的同时注明出处
1278 项目地址:https://github.com/steve02081504/ELC
1279 */
1280 #undef min
1281 #undef max
1282 /*
1283 获取几个参数中的最小值或某类型能表示的最小值.
1284 用法:
1285 min.able<T1,T2...> -> bool T...等类型能否获得参数最小值.
1286 min.get_limit_able<T> -> bool 能否获得T类型能表示的最小值.
1287 min(v1,v2...) -> auto 获取v...的最小值.
1288 min(type_info<T>) -> auto 获取T能表示的最小值.
1289 */
1290 constexpr struct min_t{
1291 template<class...Args>
1292 static constexpr bool able=was_not_an_ill_form(::std::min(declvalue(Args)...));
1293
1294 template<typename T>
1295 static constexpr bool get_limit_able=was_not_an_ill_form(::std::numeric_limits<T>::min());
1296
1297 template<class...Args> requires able<Args...>
1298 [[nodiscard]]constexpr auto operator()(Args&&...rest)const{
1299 return ::std::min(forward<Args>(rest)...);
1300 }
1301 template<class T> requires able<::std::initializer_list<T>>
1302 [[nodiscard]]constexpr auto operator()(::std::initializer_list<T>l)const{
1303 return ::std::min(l);
1304 }
1305 template<typename T> requires get_limit_able<T>
1306 [[nodiscard]]constexpr auto operator()(type_info_t<T>)const{
1307 return ::std::numeric_limits<T>::min();
1308 }
1310 /*
1311 获取几个参数中的最大值或某类型能表示的最大值.
1312 用法:
1313 max.able<T1,T2...> -> bool T...等类型能否获得参数最大值.
1314 max.get_limit_able<T> -> bool 能否获得T类型能表示的最大值.
1315 max(v1,v2...) -> auto 获取v...的最大值.
1316 max(type_info<T>) -> auto 获取T能表示的最大值.
1317 */
1318 constexpr struct max_t{
1319 template<class...Args>
1320 static constexpr bool able=was_not_an_ill_form(::std::max(declvalue(Args)...));
1321
1322 template<typename T>
1323 static constexpr bool get_limit_able=was_not_an_ill_form(::std::numeric_limits<T>::max());
1324
1325 template<class...Args> requires able<Args...>
1326 [[nodiscard]]constexpr auto operator()(Args&&...rest)const{
1327 return ::std::max(forward<Args>(rest)...);
1328 }
1329 template<class T> requires able<::std::initializer_list<T>>
1330 [[nodiscard]]constexpr auto operator()(::std::initializer_list<T>l)const{
1331 return ::std::max(l);
1332 }
1333 template<typename T> requires get_limit_able<T>
1334 [[nodiscard]]constexpr auto operator()(type_info_t<T>)const{
1335 return ::std::numeric_limits<T>::max();
1336 }
1338
1339 //file_end
1340
1341 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1342 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/null_ptr.hpp"
1343 //null_ptr.hpp
1344 //at namespace elc::defs::base
1345 /*
1346 未完成的elc解释器base_defs文件
1347 由steve02081504与Alex0125设计、编写
1348 转载时请在不对此文件做任何修改的同时注明出处
1349 项目地址:https://github.com/steve02081504/ELC
1350 */
1351 namespace null_ptr_n{
1352 /*
1353 提醒子类定义者重载get_null_ptr.
1354 */
1356
1357 /*
1358 force_use_default_null_ptr :
1359 可不重载get_null_ptr
1360 在此类ref_able或weak_ref_able时,意味着使用者**保证**所有指向此类的实例的ptr都不可为null_ptr
1361 否则将内存访问错误
1362 */
1364
1365 enable_adl(the_get_null_ptr);
1366 template<typename T>
1367 [[nodiscard]]constexpr auto get_null_ptr()noexcept{
1368 suppress_msvc_warning(26462)//貌似msvc在这里有bug
1369 constexpr auto null_as_T = static_cast<T*>(nullptr);
1370 if constexpr(was_not_an_ill_form(the_get_null_ptr(null_as_T)))
1371 return the_get_null_ptr(null_as_T);
1372 elseif constexpr(type_info<T>.has_attribute(can_t_use_default_null_ptr)&&type_info<T>.not_has_attribute(force_use_default_null_ptr)){
1373 template_error("please overload the function the_get_null_ptr in the namespace where this type is defined.");
1374 return null_as_T;
1375 }
1376 else
1377 return null_as_T;
1378 }
1379
1380
1381 /*
1382 字面量null_ptr,如同nullptr使用即可.
1383 */
1384 constexpr struct null_ptr_t{
1385 template<typename T>
1386 [[nodiscard]]constexpr_as(get_null_ptr<remove_cvref<T>>())auto base_get()const noexcept{return get_null_ptr<remove_cvref<T>>();}
1387 template<typename T>
1388 [[nodiscard]]constexpr_as(base_get<T>())operator T*()const noexcept{return down_cast<T*>(base_get<T>());}
1389 //constexpr operator decltype(nullptr)()const noexcept{return nullptr;}//提醒接口设计者注意null_ptr的重载版本.
1390 }null_ptr{};
1391
1392 template<typename T,typename U=decltype(*null_ptr.base_get<T>())>
1393 [[nodiscard]]auto operator==(T*a,null_ptr_t)noexcept{
1394 return null_ptr.base_get<T>()==static_cast<const remove_ref<U>*>(add_const(a));
1395 }
1396 }
1400 typedef decltype(null_ptr) null_ptr_t;
1401 typedef decltype(nullptr) nullptr_t;
1402
1403 //file_end
1404
1405 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1406 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/compare.hpp"
1407 //compare.hpp
1408 //at namespace elc::defs::base
1409 /*
1410 未完成的elc解释器base_defs文件
1411 由steve02081504与Alex0125设计、编写
1412 转载时请在不对此文件做任何修改的同时注明出处
1413 项目地址:https://github.com/steve02081504/ELC
1414 */
1415 //end_by_zero_t
1416 /*
1417 用于标志某一数据串以0结尾
1418 */
1419 inline constexpr struct end_by_zero_t{}end_by_zero;
1420 //just_an_part_t
1421 /*
1422 用于标志某一数据串并没有完结
1423 */
1424 inline constexpr struct just_an_part_t{}just_an_part;
1425 //equal:值相等.
1426 /*
1427 相等比较任意支持比较的类型或其数组——简易封装.
1428 用法:
1429 判断两值是否可比较。
1430 equal.able<类型1,类型2(可选,默认为类型1)> -> bool
1431 判断将两者进行比较时是否会抛出异常。
1432 equal.nothrow<类型,类型2(可选,默认为类型1)> -> bool
1433
1434 equal(T1,T2) -> auto
1435
1436 equal(T1[N1],T2[N2]) -> bool
1437 equal(T1*,size1,T2*,size2) -> bool
1438 equal(T1*,T2*,size) -> bool
1439 equal(T1*,size1,T2*,end_by_zero) -> bool
1440 equal(T1*,end_by_zero,T2*,size) -> bool
1441 equal(T1*,end_by_zero,T2*,end_by_zero) -> bool
1442 */
1443 constexpr struct equal_t{
1444 template<class T,class U=T>
1445 static constexpr bool able= was_not_an_ill_form(declvalue(T)==declvalue(U));
1446 template<class T,class U=T>
1447 static constexpr bool nothrow= was_not_an_ill_form_and_noexcept(declvalue(T)==declvalue(U));
1448
1449 template<typename T,typename U>
1450 [[nodiscard]]constexpr auto operator()(T&&a,U&&b)const noexcept(nothrow<T,U>){
1451 return a==b;
1452 }
1453 template<typename T,typename U>
1454 [[nodiscard]]constexpr bool operator()(T*a,U*b,size_t size)const noexcept(nothrow<T,U>){
1455 while(size--){
1456 if(*(a++)!=*(b++))
1457 return false;
1458 }
1459 return true;
1460 }
1461 template<typename T,typename U,size_t N1,size_t N2>
1462 [[nodiscard]]constexpr bool operator()(T(&a)[N1],U(&b)[N2])const noexcept(nothrow<T,U>){
1463 if constexpr(N1==N2)
1464 return operator()(a,b,N1);
1465 else{
1466 template_warning("N1!=N2");
1467 return false;
1468 }
1469 }
1470 template<typename T,typename U>
1471 [[nodiscard]]constexpr bool operator()(T*a,size_t size1,U*b,size_t size2)const noexcept(nothrow<T,U>){
1472 if(size1==size2)
1473 return operator()(a,b,size1);
1474 else
1475 return false;
1476 }
1477 template<typename T,typename U>
1478 [[nodiscard]]constexpr bool operator()(T*a,size_t size1,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1479 while(size1--){
1480 if(*a!=*b || *b==U{0})
1481 return false;
1482 a++;
1483 b++;
1484 }
1485 return *b==U{0};
1486 }
1487 template<typename T,typename U>
1488 [[nodiscard]]constexpr bool operator()(T*a,end_by_zero_t,U*b,size_t size2)const noexcept(nothrow<T,U>){
1489 return operator()(b,size2,a,end_by_zero);
1490 }
1491 template<typename T,typename U>
1492 [[nodiscard]]constexpr bool operator()(T*a,end_by_zero_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1493 floop{
1494 if(*a!=*b)
1495 return false;
1496 if(*a==T{0})
1497 return true;
1498 a++;
1499 b++;
1500 }
1501 }
1502 template<typename T,typename U>
1503 [[nodiscard]]constexpr bool operator()(T*a,size_t size1,just_an_part_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1504 while(size1--){
1505 if(*a!=*b || *b==U{0})
1506 return false;
1507 a++;
1508 b++;
1509 }
1510 return true;
1511 }
1513
1514 //eq:同一对象
1515 template<typename T>
1516 [[nodiscard]]constexpr auto is_eq(T&&a,T&&b)noexcept_as(&a==&b){
1517 return &a==&b;
1518 }
1519 template<typename T>
1520 [[nodiscard]]constexpr auto is_not_eq(T&&a,T&&b)noexcept_as(!is_eq(a,b)){
1521 return!is_eq(a,b);
1522 }
1523
1524 //compare:三路比较
1525 /*
1526 若大小相同则以字典序三路比较任意支持比较的类型或其数组,并在 <=> 不可用时以 < 和 == 为后备.
1527 用法:
1528 判断两者是否可真的进行三路比较。
1529 compare.r_able<类型1,类型2(可选,默认与1相同)> -> bool
1530 判断两者是否可进行compare操作。
1531 compare.able<类型1,类型2(可选,默认与1相同)> -> bool
1532 判断将两者进行三路比较是否会抛出异常。
1533 compare.nothrow<类型1,类型2(可选,默认与1相同)> -> bool
1534
1535 compare(T1,T2)
1536 compare(T1[N1],T2[N2])
1537 compare(T1*,size1,T2*,size2)
1538 compare(T1*,T2*,size)
1539 返回类型语义上是三路比较的结果类型,具体类型视情况而定.
1540
1541 以字典序进行三路比较。
1542 compare.lexicographical(T1,T2)
1543 compare.lexicographical(T1[N1],T2[N2])
1544 compare.lexicographical(T1*,size1,T2*,size2)
1545 compare.lexicographical(T1*,T2*,size)
1546 返回类型语义上是三路比较的结果类型,具体类型视情况而定.
1547
1548 翻转三路比较的结果类型。
1549 compare.reverse(order)
1550 返回对应结果类型的反义,与零相等或无法比较时则返回其本身。
1551 */
1552 constexpr struct compare_t{
1553 template<class T,class U=T>
1554 static constexpr bool r_able= was_not_an_ill_form(declvalue(T)<=>declvalue(U));
1555
1556 template<class T,class U=T>
1557 static constexpr bool able= r_able<T,U> ||
1559 declvalue(T)==declvalue(U),
1560 declvalue(T)<declvalue(U),
1561 declvalue(U)<declvalue(T)
1562 );
1563 template<class T,class U=T>
1564 static constexpr bool nothrow= was_not_an_ill_form_and_noexcept(declvalue(T)<=>declvalue(U)) ||
1566 declvalue(T)==declvalue(U),
1567 declvalue(T)<declvalue(U),
1568 declvalue(U)<declvalue(T)
1569 );
1570
1571
1572 template<class T,class U>
1573 [[nodiscard]]static constexpr auto base_call(T&&a,U&&b)noexcept(nothrow<T,U>){
1574 //在 <=> 不可用时以 < 和 == 为后备,优于直接 <=>
1575 if constexpr(r_able<T,U>)
1576 return a<=>b;
1577 else return a == b ? partial_ordering::equivalent :
1578 a < b ? partial_ordering::less :
1579 b < a ? partial_ordering::greater :
1580 partial_ordering::unordered ;
1581 }
1582
1583 template<class T,class U=T>
1584 using type=decltype(base_call(declvalue(T),declvalue(U)));
1585
1586 template<typename T,typename U>
1587 [[nodiscard]]constexpr auto operator()(T&&a,U&&b)const noexcept(nothrow<T,U>){
1588 return base_call(a,b);
1589 }
1590 template<typename T,typename U>
1591 [[nodiscard]]constexpr auto operator()(T*a,U*b,size_t size)const noexcept(nothrow<T,U>){
1592 while(size--){
1593 if(auto tmp=base_call(*(a++),*(b++)); tmp!=0)
1594 return tmp;
1595 }
1596 return strong_ordering::equivalent;
1597 }
1598 template<typename T,typename U,size_t N1,size_t N2>
1599 [[nodiscard]]constexpr auto operator()(T(&a)[N1],U(&b)[N2])const noexcept(nothrow<T,U>){
1600 if constexpr(N1==N2)
1601 return operator()(a,b,N1);
1602 else{
1603 template_warning("N1!=N2");
1604 return N1<=>N2;
1605 }
1606 }
1607 template<typename T,typename U>
1608 [[nodiscard]]constexpr auto operator()(T*a,size_t size1,U*b,size_t size2)const noexcept(nothrow<T,U>){
1609 type<T,U> tmp=size1<=>size2;
1610 if(tmp!=0)
1611 return tmp;
1612 else
1613 return operator()(a,b,size1);
1614 }
1615 template<typename T,typename U>
1616 [[nodiscard]]constexpr auto operator()(T*a,size_t size1,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1617 type<T,U> tmp=strong_ordering::equivalent;
1618 while(size1--){
1619 if(*b==U{0})
1620 return strong_ordering::greater;
1621 if(tmp==0)
1622 tmp=base_call(*a,*b);
1623 a++;
1624 b++;
1625 }
1626 return *b==U{0}?tmp:strong_ordering::less;
1627 }
1628 template<typename T,typename U>
1629 [[nodiscard]]constexpr auto operator()(T*a,end_by_zero_t,U*b,size_t size2)const noexcept(nothrow<T,U>){
1630 type<T,U> tmp=strong_ordering::equivalent;
1631 while(size2--){
1632 if(*a==T{0})
1633 return strong_ordering::less;
1634 if(tmp==0)
1635 tmp=base_call(*a,*b);
1636 a++;
1637 b++;
1638 }
1639 return *b==U{0}?tmp:strong_ordering::less;
1640 }
1641 template<typename T,typename U>
1642 [[nodiscard]]constexpr auto operator()(T*a,end_by_zero_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1643 type<T,U> tmp=strong_ordering::equivalent;
1644 floop{
1645 if(*a==T{0})
1646 return *b==U{0}?tmp:strong_ordering::less;
1647 if(tmp==0)
1648 tmp=base_call(*a,*b);
1649 a++;
1650 b++;
1651 }
1652 }
1653 template<typename T,typename U>
1654 [[nodiscard]]constexpr auto operator()(T*a,size_t size1,just_an_part_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1655 type<T,U> tmp=strong_ordering::equivalent;
1656 while(size1--){
1657 if(*b==U{0})
1658 return strong_ordering::greater;
1659 if(tmp==0)
1660 tmp=base_call(*a,*b);
1661 a++;
1662 b++;
1663 }
1664 return tmp;
1665 }
1666 template<typename T,typename U>
1667 [[nodiscard]]constexpr auto lexicographical(T*a,size_t size1,U*b,size_t size2)const noexcept(nothrow<T,U>){
1668 if(auto tmp=operator()(a,b,min(size1,size2)); tmp!=0)
1669 return tmp;
1670 else
1671 return size1<=>size2;
1672 }
1673 template<typename T,typename U,size_t N1,size_t N2>
1674 [[nodiscard]]constexpr auto lexicographical(T(&a)[N1],U(&b)[N2])const noexcept(nothrow<T,U>){
1675 return lexicographical(a,N1,b,N2);
1676 }
1677 template<typename T,typename U>
1678 [[nodiscard]]constexpr auto lexicographical(T*a,size_t size1,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1679 while(size1--){
1680 if(*b==U{0})
1681 return strong_ordering::greater;
1682 if(auto tmp=base_call(*a,*b); tmp!=0)
1683 return tmp;
1684 a++;
1685 b++;
1686 }
1687 return *b==U{0}?strong_ordering::equivalent:
1688 strong_ordering::less;
1689 }
1690 template<typename T,typename U>
1691 [[nodiscard]]constexpr auto lexicographical(T*a,end_by_zero_t,U*b,size_t size2)const noexcept(nothrow<T,U>){
1692 while(size2--){
1693 if(*a==T{0})
1694 return strong_ordering::less;
1695 if(auto tmp=base_call(*a,*b); tmp!=0)
1696 return tmp;
1697 a++;
1698 b++;
1699 }
1700 return *b==U{0}?strong_ordering::equivalent:
1701 strong_ordering::less;
1702 }
1703 template<typename T,typename U>
1704 [[nodiscard]]constexpr auto lexicographical(T*a,end_by_zero_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1705 floop{
1706 if(*a==T{0})
1707 return *b==U{0}?strong_ordering::equivalent:
1708 strong_ordering::less;
1709 if(auto tmp=base_call(*a,*b); tmp!=0)
1710 return tmp;
1711 a++;
1712 b++;
1713 }
1714 }
1715 template<typename T,typename U>
1716 [[nodiscard]]constexpr auto lexicographical(T*a,size_t size1,just_an_part_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1717 while(size1--){
1718 if(*b==U{0})
1719 return strong_ordering::greater;
1720 if(auto tmp=base_call(*a,*b); tmp!=0)
1721 return tmp;
1722 a++;
1723 b++;
1724 }
1725 return strong_ordering::equivalent;
1726 }
1727 //
1728 [[nodiscard]]constexpr auto reverse(partial_ordering odr)const noexcept{
1729 if(odr==partial_ordering::greater)
1730 return partial_ordering::less;
1731 elseif(odr==partial_ordering::less)
1732 return partial_ordering::greater;
1733 else
1734 return odr;
1735 }
1736 [[nodiscard]]constexpr auto reverse(weak_ordering odr)const noexcept{
1737 if(odr==weak_ordering::greater)
1738 return weak_ordering::less;
1739 elseif(odr==weak_ordering::less)
1740 return weak_ordering::greater;
1741 else
1742 return odr;
1743 }
1744 [[nodiscard]]constexpr auto reverse(strong_ordering odr)const noexcept{
1745 if(odr==strong_ordering::greater)
1746 return strong_ordering::less;
1747 elseif(odr==strong_ordering::less)
1748 return strong_ordering::greater;
1749 else
1750 return odr;
1751 }
1753
1754 //file_end
1755
1756 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1757 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/note.hpp"
1758 //note.hpp
1759 //at namespace elc::defs::base
1760 /*
1761 未完成的elc解释器base_defs文件
1762 由steve02081504与Alex0125设计、编写
1763 转载时请在不对此文件做任何修改的同时注明出处
1764 项目地址:https://github.com/steve02081504/ELC
1765 */
1766 namespace note_n{
1767 #define def_note(name)\
1768 template<typename T>\
1769 struct name##_t{\
1770 T value;\
1771 force_inline constexpr name##_t(T a):value(a){}\
1772 template<class U>\
1773 force_inline constexpr name##_t(name##_t<U>a):value(a.value){}\
1774 force_inline constexpr operator T(){return value;}\
1775 force_inline constexpr T operator()(){return value;}\
1776 };\
1777 template<typename T>\
1778 constexpr name##_t<T>name(T v){return{v};}
1779
1783
1784 #undef def_note
1785 constexpr struct fail_t{}fail{};
1786 }
1787 namespace note=note_n;
1788
1789 //file_end
1790
1791 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/array_like.hpp"
1793 //array_like.hpp
1794 //at namespace elc::defs::base
1795 /*
1796 未完成的elc解释器base_defs文件
1797 由steve02081504与Alex0125设计、编写
1798 转载时请在不对此文件做任何修改的同时注明出处
1799 项目地址:https://github.com/steve02081504/ELC
1800 */
1801 namespace array_like_n{
1802 template<class T>
1803 [[nodiscard]]inline constexpr size_t size_of_array_like(T&&)noexcept{return 1;}
1804 template<class T,size_t N>
1805 [[nodiscard]]inline constexpr size_t size_of_array_like(T(&)[N])noexcept{return N;}
1806 template<class T>
1807 [[nodiscard]]inline size_t size_of_array_like(::std::initializer_list<T>&a)noexcept{return a.size();}
1808
1809 template<class T>
1810 [[nodiscard]]inline constexpr auto begin_of_array_like(T&&a)noexcept{return addressof(a);}
1811 template<class T,size_t N>
1812 [[nodiscard]]inline constexpr auto begin_of_array_like(T(&a)[N])noexcept{return addressof(a[0]);}
1813 template<class T>
1814 [[nodiscard]]inline const T* begin_of_array_like(::std::initializer_list<T>&a)noexcept{return a.begin();}
1815
1816 template<class T>
1817 [[nodiscard]]inline auto end_of_array_like(T&&a)noexcept{return begin_of_array_like(a)+size_of_array_like(a);}
1818
1819 template<class T>
1821 (T v){
1824 }
1825 );
1826
1827 template<class T>
1829 template<class T>
1830 constexpr bool is_not_signal_value_for_array_like=!is_signal_value_for_array_like<T>;
1831
1832 template<class T,class U>
1834 (U v){
1835 begin_of_array_like<T>(v);
1836 size_of_array_like<T>(v);
1837 }
1838 );
1839
1840 template<class T>
1842 typedef T* iterator;
1843 typedef const T* const_iterator;
1845 private:
1846 T*_begin=nullptr;
1847 size_t _size=0;
1848 public:
1849 constexpr explicit array_like_view_t(T*a,size_t b)noexcept:_begin(a),_size(b){}
1850 template<class U> requires is_array_like_for<T,U>
1851 explicit constexpr_as_auto array_like_view_t(U&&a)noexcept_as(begin_of_array_like<T>(a),size_of_array_like<T>(a)):array_like_view_t(begin_of_array_like<T>(a),size_of_array_like<T>(a)){}
1852 constexpr array_like_view_t(const this_t&)noexcept=default;
1853
1854 void swap_with(this_t&b)noexcept_as(swap(_begin,b._begin),swap(_size,b._size)){
1855 swap(_begin,b._begin);
1856 swap(_size,b._size);
1857 }
1858
1859 [[nodiscard]]constexpr const_iterator c_str()const noexcept{return _begin;}
1860 [[nodiscard]]constexpr size_t size()const noexcept{return _size;}
1861
1862 [[nodiscard]]constexpr iterator begin()noexcept requires(type_info<iterator>!=type_info<const_iterator>){return _begin;}
1863 [[nodiscard]]constexpr iterator end()noexcept requires(type_info<iterator>!=type_info<const_iterator>){return begin()+size();}
1864 [[nodiscard]]constexpr const_iterator begin()const noexcept{return _begin;}
1865 [[nodiscard]]constexpr const_iterator end()const noexcept{return begin()+size();}
1866
1867 [[nodiscard]]constexpr const_iterator cbegin()const noexcept{return remove_const(this)->begin();}
1868 [[nodiscard]]constexpr const_iterator cend()const noexcept{return remove_const(this)->end();}
1869
1870 [[nodiscard]]constexpr bool empty()const noexcept{return size();}
1871
1872 [[nodiscard]]constexpr T&operator[](size_t pos)noexcept{return begin()[pos];}
1873 [[nodiscard]]constexpr const T&operator[](size_t pos)const noexcept{return remove_const(*this)[pos];}
1874
1875 [[nodiscard]]constexpr auto operator<=>(this_t a)noexcept(compare.nothrow<T>){
1876 return compare(_begin,_size,a._begin,a._size);
1877 }
1878 [[nodiscard]]constexpr auto operator==(this_t a)noexcept(equal.nothrow<T>){
1879 return equal(_begin,_size,a._begin,a._size);
1880 }
1881 };
1882 template<typename T>
1885 using base_t::base_t;
1886
1887 [[nodiscard]]constexpr static size_t get_length_of(T*ptr){
1888 if(*ptr)return get_length_of(ptr+1)+1;
1889 else return 0;
1890 }
1891
1892 constexpr array_end_by_zero_t(T*ptr):base_t(ptr,get_length_of(ptr)){}
1893 };
1894
1895 template<class T>
1896 [[nodiscard]]inline constexpr T* begin_of_array_like(array_like_view_t<T>&a)noexcept requires(type_info<T>!=type_info<const T>){return a.begin();}
1897 template<class T>
1898 [[nodiscard]]inline constexpr auto begin_of_array_like(const array_like_view_t<T>&a)noexcept{return a.begin();}
1899 template<class T>
1900 [[nodiscard]]inline constexpr T* begin_of_array_like(array_like_view_t<remove_cv<T>>&a)noexcept{return a.begin();}
1901 template<class T>
1902 [[nodiscard]]inline constexpr size_t size_of_array_like(const array_like_view_t<T>&a)noexcept{return a.size();}
1903 }
1913
1914 //file_end
1915
1916 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1917 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/data.hpp"
1918 //data.hpp
1919 //at namespace elc::defs::base
1920 /*
1921 未完成的elc解释器base_defs文件
1922 由steve02081504与Alex0125设计、编写
1923 转载时请在不对此文件做任何修改的同时注明出处
1924 项目地址:https://github.com/steve02081504/ELC
1925 */
1926 /*
1927 每个T的可能性大小
1928 */
1929 template<class T> requires ::std::is_integral_v<T>
1930 constexpr size_t number_of_possible_values_per=max(type_info<::std::make_unsigned_t<T>>)+size_t{1};
1931 /*
1932 每个T有多少位
1933 */
1934 template<class T>
1935 constexpr size_t bitnumof=sizeof(T)*CHAR_BIT;
1936
1937 /*
1938 功能: byte* 类型数据转换为 T&,不进行任何检查
1939 用法: data_cast<T>(byte*) -> T&
1940 */
1941 template<class T>
1942 [[nodiscard]]constexpr T&data_cast(byte*p){return*::std::launder(reinterpret_cast<T*>(p));}
1943 /*
1944 功能: T* 指针转换为 byte*,不进行任何检查
1945 用法: cast_to_data(T*) -> byte*
1946 */
1947 template<class T>
1948 [[nodiscard]]constexpr byte*cast_to_data(T*p){return ::std::launder(reinterpret_cast<byte*>(p));}
1949 /*
1950 功能: const T* 指针转换为 const byte*,不进行任何检查
1951 用法: cast_to_data(const T*) -> const byte*
1952 */
1953 template<class T>
1954 [[nodiscard]]constexpr const byte*cast_to_data(const T*p){return ::std::launder(reinterpret_cast<const byte*>(p));}
1955
1956 /*
1957 功能: data_block类模板,接受多个类型参数,实例化为内含最大体积最大对齐要求的byte数组的结构体
1958 data_block -> byte*
1959 用法: data_block<T1,T2,...>value;
1960 */
1961 template<class...Ts>
1964 alignas(max({alignof(Ts)...}))
1965 byte _data[max({sizeof(Ts)...})];
1966 constexpr operator byte*(){return _data;}
1968 };
1969
1970 /*
1971 功能: data_view类模板,接受一个类型参数,提供对byte数组的访问和遍历
1972 用法: data_view<T>value{&value};
1973 */
1974 template<class T>
1976 using array_like_view_t<byte>::array_like_view_t;
1977 constexpr data_view(T*p):array_like_view_t<byte>{cast_to_data(p),sizeof(T)}{}
1978 };
1979 template<class T>
1980 struct data_view<const T>:array_like_view_t<const byte>{
1981 using array_like_view_t<const byte>::array_like_view_t;
1982 constexpr data_view(const T*p):array_like_view_t<const byte>{cast_to_data(p),sizeof(T)}{}
1983 };
1984
1985 /*
1986 功能: 比较两个类实例在内存中的内容是否相同
1987 用法: full_equal_in_byte(const T&a,const T&b) -> bool
1988 */
1989 template<class T>
1990 [[nodiscard]]constexpr bool full_equal_in_byte(const T&a,const T&b){
1991 return equal(cast_to_data(&a),cast_to_data(&b),sizeof(T));
1992 }
1993
1994 //file_end
1995
1996 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1997 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/pointer.hpp"
1998 //pointer.hpp
1999 //at namespace elc::defs::base
2000 /*
2001 未完成的elc解释器base_defs文件
2002 由steve02081504与Alex0125设计、编写
2003 转载时请在不对此文件做任何修改的同时注明出处
2004 项目地址:https://github.com/steve02081504/ELC
2005 */
2006
2008 //指针转bool的重载接口,允许类对此进行自定义
2009 //elc内部的指针转bool应当视情况使用默认配置或此重载接口
2010 template<typename T>
2011 [[nodiscard]]constexpr auto pointer_to_bool(T*a)noexcept{
2013 return the_pointer_to_bool(a);
2014 else
2015 return null_ptr!=a;
2016 }
2017
2019 //指针比较的重载接口,允许类对此进行自定义
2020 //elc内部的指针比较应当视情况使用默认配置或此重载接口
2021 template<typename T>
2022 [[nodiscard]]constexpr auto pointer_equal(T*a,T*b)noexcept{
2023 if constexpr(was_not_an_ill_form(the_pointer_equal(a,b)))
2024 return the_pointer_equal(a,b);
2025 else
2026 return a==b;
2027 }
2028
2029 //判断类型是否为指针
2030 template<class T>
2031 inline constexpr bool is_pointer= ::std::is_pointer_v<T>;
2032 //未知类型指针
2033 typedef void*pointer;
2034 //未知类型指针,不可写
2035 typedef const void*const_pointer;
2036
2037 //获取两个指针的偏移
2038 [[nodiscard]]constexpr ptrdiff_t get_off_set(note::from_t<const_pointer>a,note::to_t<const_pointer>b)noexcept{
2039 return cast_to_data(b())-cast_to_data(a());//b-a == c
2040 }
2041 //应用偏移
2042 template<class T>
2043 [[nodiscard]]constexpr auto apply_off_set(T*a,ptrdiff_t c)noexcept{
2044 return cast_to_data(a)+c;//a+c == b
2045 }
2046 //反向应用偏移
2047 template<class T>
2048 [[nodiscard]]constexpr auto unapply_off_set(T*b,ptrdiff_t c)noexcept{
2049 return cast_to_data(b)-c;//b-c == a
2050 }
2051
2052 //file_end
2053
2054 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2055 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/hash.hpp"
2056 //hash.hpp
2057 //at namespace elc::defs::base
2058 /*
2059 未完成的elc解释器base_defs文件
2060 由steve02081504与Alex0125设计、编写
2061 转载时请在不对此文件做任何修改的同时注明出处
2062 项目地址:https://github.com/steve02081504/ELC
2063 */
2064 namespace hash_n{
2065 typedef size_t hash_base_t;
2068 constexpr hash_base_t operator%(auto&&a)const noexcept{
2069 return _value%a;
2070 }
2071 constexpr bool operator==(const hash_value_t&a)const noexcept{
2072 return _value==a._value;
2073 }
2074 };
2077 };
2078
2079 template<class T>
2080 inline constexpr bool is_unstable_hash = type_info<T const>.can_convert_to<unstable_hash_value_t>;
2081 template<class T>
2082 inline constexpr bool is_fundamental_hash = ::std::is_fundamental_v<T>;
2083
2084 enable_adl(the_pointer_hash);
2085 template<class T>
2086 [[nodiscard]]inline constexpr hash_value_t pointer_hash(T*a)noexcept{
2087 if constexpr(was_not_an_ill_form(the_pointer_hash(a)))
2088 return the_pointer_hash(a);
2089 else
2090 return{hash_base_t(a)};
2091 }
2092
2093 inline struct hash_t{
2094 template<class T>
2095 [[nodiscard]]static constexpr inline bool nothrow_helper()noexcept{
2096 if constexpr(is_pointer<T>)
2097 return noexcept(pointer_hash(declvalue(const T&)));
2098 elseif constexpr(is_fundamental_hash<T>)
2099 return noexcept(hash_value_t{hash_base_t(declvalue(const T&))});
2100 elseif constexpr(is_unstable_hash<T>)
2101 return noexcept(unstable_hash_value_t(declvalue(const T&)));
2102 elseif constexpr(was_not_an_ill_form(declvalue(const T&).hash()))
2103 return noexcept(declvalue(const T&).hash());
2104 elseif constexpr(was_not_an_ill_form(hash_value_t(declvalue(const T&))))
2105 return noexcept(hash_value_t(declvalue(const T&)));
2106 elseif constexpr(type_info<remove_cv<T>> == type_info<base_type_info_t>)
2107 return true;
2108 else
2109 return false;
2110 }
2111 template<class T>
2112 static constexpr bool nothrow=nothrow_helper<T>();
2113 template<class T>
2114 [[nodiscard]]static constexpr inline bool able_helper()noexcept{
2115 if constexpr(is_pointer<T>)
2116 return true;
2117 elseif constexpr(is_fundamental_hash<T>)
2118 return true;
2119 elseif constexpr(is_unstable_hash<T>)
2120 return true;
2121 elseif constexpr(was_not_an_ill_form(declvalue(const T&).hash()))
2122 return true;
2123 elseif constexpr(was_not_an_ill_form(hash_value_t(declvalue(const T&))))
2124 return true;
2125 elseif constexpr(type_info<remove_cv<T>> == type_info<base_type_info_t>)
2126 return true;
2127 else
2128 return false;
2129 }
2130 template<class T>
2131 static constexpr bool able=able_helper<T>();
2132
2133 #define hash operator()
2134
2135 [[nodiscard]]inline constexpr hash_value_t hash(nothing)const noexcept{
2136 return{hash_base_t(nothing)};
2137 }
2138 [[nodiscard]]inline hash_value_t hash(const base_type_info_t&a)const noexcept{
2139 return{a.get_hash()};
2140 }
2141 template<class T> requires able<T>
2142 [[nodiscard]]constexpr_as_auto inline auto hash(const T&a)const noexcept(nothrow<T>){
2143 #undef hash
2144 if constexpr(is_pointer<T>)
2145 return pointer_hash(a);
2146 elseif constexpr(is_fundamental_hash<T>)
2147 return hash_value_t{hash_base_t(a)};
2148 elseif constexpr(is_unstable_hash<T>)
2149 return unstable_hash_value_t(a);
2150 elseif constexpr(was_not_an_ill_form(declvalue(const T&).hash()))
2151 return a.hash();
2152 elseif constexpr(was_not_an_ill_form(hash_value_t(declvalue(const T&))))
2153 return hash_value_t(a);
2154 else{
2155 template_error("Please overload the function hash in the namespace where this type is defined.");
2156 return hash_value_t{};
2157 }
2158 #define hash operator()
2159 }
2160 template<class T>
2161 [[nodiscard]]constexpr_as_auto inline hash_base_t get_hash_in_base_type(const T&a)const noexcept(nothrow<T>){
2162 return hash(a)._value;
2163 }
2164
2165 /*从某个起始点算起的hash*/
2166 template<class T>
2167 [[nodiscard]]force_inline constexpr hash_value_t with_calculated_before(hash_value_t before,size_t before_size,const T*a,size_t size)const noexcept{
2168 hash_base_t aret=before._value;
2169 rot_iterator<decltype(aret)>rotl_offset = before_size+size;
2170 while(size--){
2171 aret ^= rotl(get_hash_in_base_type(a[size]),rotl_offset);
2172 rotl_offset--;
2173 }
2174 return{aret};
2175 }
2176 /*计算此hash重复N次的数组的hash结果*/
2177 [[nodiscard]]force_inline constexpr hash_value_t repeat_times(hash_value_t value,size_t size)const noexcept{
2178 hash_base_t aret=0;
2179 {
2180 //优化.
2181 //关於此,咱确信咱发现一种美妙的证法来保证这个优化不影响结果,但可惜凋可怜的脑容量不足以让他看懂.
2182 constexpr size_t bit_range_max=bitnum_of(hash_base_t);
2183 constexpr hash_base_t void_hash{nothing};
2184 suppress_msvc_warning(26475)//强制转换警告diss.
2185 constexpr hash_base_t npos_hash{hash_base_t(-1)};
2186 constexpr size_t bitnumof_void=bit_range_max*BIT_POSSIBILITY;
2187
2188 size=size%bitnumof_void;
2189 if(value._value==0 || size==0)
2190 return {void_hash};
2191 if(size >= bit_range_max){
2192 const bool is_npos = ::std::popcount(value._value)%BIT_POSSIBILITY;
2193 aret = is_npos?npos_hash:void_hash;
2194 size-=bit_range_max;
2195 }
2196 if(!size)
2197 return {aret};
2198 }
2199 rot_iterator<decltype(aret)>rotl_offset = size;
2200 while(size--){
2201 aret ^= rotl(value._value,rotl_offset);
2202 rotl_offset--;
2203 }
2204 return{aret};
2205 }
2206 /*计算此hash重复N次的数组的hash结果*/
2207 template<class T>
2208 [[nodiscard]]force_inline constexpr hash_value_t repeat_times(T&&value,size_t size)const noexcept{
2209 return repeat_times(hash(value),size);
2210 }
2211 template<class T>
2212 [[nodiscard]]constexpr inline hash_value_t hash(const T*a,size_t size)const noexcept(nothrow<const T>){
2213 return with_calculated_before(hash(nothing),0,a,size);
2214 }
2215 /*合并两个数据段的hash结果,好似计算这两个数据段合并后的hash结果一般*/
2217 hash_value_t before,size_t before_size,hash_value_t after,[[maybe_unused]]size_t after_size
2218 )const noexcept{
2219 return{before._value^(rotl(after._value,before_size))};
2220 }
2221 template<class T> requires is_not_signal_value_for_array_like<T>
2222 [[nodiscard]]constexpr inline hash_value_t hash(const array_like_view_t<T>a)const noexcept(nothrow<T>){
2223 return hash(a.begin(),a.size());
2224 }
2225 template<class T> requires is_not_signal_value_for_array_like<T>
2226 [[nodiscard]]constexpr inline hash_value_t with_calculated_before(hash_value_t before,size_t before_size,const array_like_view_t<T>a)const noexcept{
2227 return with_calculated_before(before,before_size,a.begin(),a.size());
2228 }
2229
2230 #undef hash
2231
2233 }
2238 using hash_n::hash;
2239
2240 //file_end
2241
2242 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2243 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/range.hpp"
2244 //range.hpp
2245 //at namespace elc::defs::base
2246 /*
2247 未完成的elc解释器base_defs文件
2248 由steve02081504与Alex0125设计、编写
2249 转载时请在不对此文件做任何修改的同时注明出处
2250 项目地址:https://github.com/steve02081504/ELC
2251 */
2252 namespace range_n{
2253 //range_t
2254 //用以表示某类型的数值范围,仅可表示闭区间
2255 template<typename T>
2256 struct range_t{
2257 T _begin,_end;
2258 //_begin<=_end
2259 constexpr range_t(const T begin,const T end):_begin(begin),_end(end){}
2260 constexpr range_t(note::from_t<const T>begin,note::to_t<const T>end):_begin(begin),_end(end+1){}
2261 constexpr range_t(note::to_t<const T>end,note::from_t<const T>begin):_begin(begin),_end(end+1){}
2262 constexpr range_t(const T begin,note::size_t<const T>size):_begin(begin),_end(begin+size()){}
2263 constexpr range_t(const T begin,note::size_t<size_t>size):_begin(begin),_end(begin+size()){}
2264
2265 constexpr size_t size()noexcept{return _end-_begin;}
2266 constexpr auto end()noexcept{return _end;}
2267 constexpr auto begin()noexcept{return _begin;}
2268 constexpr auto end()const noexcept{return _end;}
2269 constexpr auto begin()const noexcept{return _begin;}
2270
2271 template <class U> requires(type_info<T>.can_convert_to<U>)
2272 constexpr operator range_t<U>()const noexcept(type_info<T>.can_nothrow_convert_to<U>){
2273 return {_begin,_end};
2274 }
2275 };
2276
2277 template<class T>
2278 [[nodiscard]]inline auto size_of_array_like(range_t<T*>&a)noexcept{return a.size();}
2279 template<class T>
2280 [[nodiscard]]inline auto size_of_array_like(range_t<const T*>&a)noexcept{return a.size();}
2281
2282 template<class T>
2283 [[nodiscard]]inline auto begin_of_array_like(range_t<T*>&a)noexcept{return a.begin();}
2284 template<class T>
2285 [[nodiscard]]inline auto begin_of_array_like(range_t<const T*>&a)noexcept{return a.begin();}
2286
2287 //in_range
2288 //判断一个值是否在某个范围内
2289 template<typename T>
2290 [[nodiscard]]constexpr bool in_range(T pattern,const range_t<T>range)noexcept_as(bool(declvalue(T)>=declvalue(const T) && declvalue(T)<=declvalue(const T))){//算术类型或指针
2291 return bool(pattern>=range.begin() && pattern<range.end());
2292 }
2293 //in_range
2294 //判断一个指针是否在某个byte指针范围内
2295 template<typename T>
2296 [[nodiscard]]constexpr bool in_range(T*pattern,const range_t<byte*>range)noexcept{
2297 return cast_to_data(pattern)>=range.begin() && cast_to_data(pattern)<range.end();
2298 }
2299 //match_pattern
2300 //BMH2改算法表头,用以实施头起始的快速子串匹配算法
2301 //大部分情况下应当编译时预构建或对运行时生成的实例进行缓存
2302 template<typename T>
2305 typedef unsigned char index_type;
2306
2307 size_t skip_table[number_of_possible_values_per<index_type>]{};
2308 size_t radical_skip_table[number_of_possible_values_per<index_type>]{};
2309 index_type pre_index_table[number_of_possible_values_per<index_type>]{};
2310
2311 static constexpr index_type get_index_of(T&ch)noexcept{
2312 return index_type(hash(ch) % number_of_possible_values_per<index_type>);
2313 }
2314 constexpr void build_table(array_like_view_t<T>pattern)noexcept{
2315 const size_t m=pattern.size();
2316 if(!m)
2317 return;
2318 for(size_t i=0;i<number_of_possible_values_per<index_type>;i++){
2319 skip_table[i]=radical_skip_table[i]=m;
2320 }
2321 skip_table[get_index_of(pattern[0])]=radical_skip_table[get_index_of(pattern[0])]=m-1;//单独处理pattern[0]的情况
2322 for(size_t i=1;i<m-1;i++){
2323 index_type index=get_index_of(pattern[i]);//radical_skip_table[index]表示pattern中倒数第二次出现的index到pattern末尾的距离
2324 radical_skip_table[index]=skip_table[index];//当index在pattern中出现0次或1次时,radical_skip_table[index]等于模式串长度m
2325 skip_table[index]=m-i-1;//skip数组的定义与BMH算法相同
2326 pre_index_table[index]=get_index_of(pattern[i-1]);
2327 }
2328 }
2329 constexpr match_pattern(array_like_view_t<T>pattern)noexcept:_pattern(pattern){
2330 build_table(_pattern);
2331 }
2332 [[nodiscard]]constexpr T* match(array_like_view_t<T>range)const noexcept{
2333 size_t m = _pattern.size();
2334 if(!m)
2335 return range.begin();
2336 size_t n= range.size();
2337 size_t i= m-1;
2338 while(i<n){
2339 size_t k=i;
2340 ptrdiff_t j=m-1;//k记录text中每次从右至左开始比较的起始位置
2341 while((j>=0)&&(_pattern[j]==range[i])){
2342 i--;j--;
2343 }
2344 if(j==-1)
2345 return addressof(range[i+1]);//在range[i+1]处匹配成功
2346 index_type index_k=get_index_of(range[k]);
2347 if(get_index_of(range[k-1])!=pre_index_table[index_k])
2348 i=k+radical_skip_table[index_k];//采用激进策略移动文本指针
2349 else
2350 i=k+skip_table[index_k];
2351 }
2352 return nullptr;//匹配失败
2353 }
2354 };
2355 //reverse_match_pattern
2356 //反向BMH2改算法表头,用以实施尾起始的快速子串匹配算法
2357 //大部分情况下应当编译时预构建或对运行时生成的实例进行缓存
2358 template<typename T>
2361 typedef unsigned char index_type;
2362
2363 size_t skip_table[number_of_possible_values_per<index_type>]{};
2364 size_t radical_skip_table[number_of_possible_values_per<index_type>]{};
2365 index_type pre_index_table[number_of_possible_values_per<index_type>]{};
2366
2367 static constexpr index_type get_index_of(T&ch)noexcept{
2368 return index_type(hash(ch) % number_of_possible_values_per<index_type>);
2369 }
2370 constexpr void build_table(array_like_view_t<T>pattern)noexcept{
2371 const size_t m=pattern.size();
2372 if(!m)
2373 return;
2374 for(size_t i=0;i<number_of_possible_values_per<index_type>;i++){
2375 skip_table[i]=radical_skip_table[i]=m;
2376 }
2377 skip_table[get_index_of(pattern[m-1])]=radical_skip_table[get_index_of(pattern[m-1])]=m-1;//单独处理pattern[m-1]的情况
2378 for(ptrdiff_t i=m-2;i>=0;i--){
2379 index_type index=get_index_of(pattern[i]);//radical_skip_table[index]表示pattern中倒数第二次出现的index到pattern末尾的距离
2380 radical_skip_table[index]=skip_table[index];//当index在pattern中出现0次或1次时,radical_skip_table[index]等于模式串长度m
2381 skip_table[index]=i;//skip数组的定义与BMH算法相同
2382 pre_index_table[index]=get_index_of(pattern[i+1]);
2383 }
2384 }
2385 constexpr reverse_match_pattern(array_like_view_t<T>pattern)noexcept:_pattern(pattern){
2386 build_table(_pattern);
2387 }
2388 [[nodiscard]]constexpr T* match(array_like_view_t<T>range)const noexcept{
2389 size_t m=_pattern.size();
2390 if(!m)
2391 return range.begin();
2392 size_t n= range.size();
2393 ptrdiff_t i= n-m;
2394 while(i>=0){
2395 size_t k=i;
2396 size_t j=0;//k记录text中每次从右至左开始比较的起始位置
2397 while((j<=m-1)&&(_pattern[j]==range[i])){
2398 i++;j++;
2399 }
2400 if(j==m)
2401 return addressof(range[k]);//在range[k]处匹配成功
2402 index_type index_k=get_index_of(range[k]);
2403 if(get_index_of(range[k+1])!=pre_index_table[index_k])
2404 i=k-radical_skip_table[index_k];//采用激进策略移动文本指针
2405 else
2406 i=k-skip_table[index_k];
2407 }
2408 return nullptr;//匹配失败
2409 }
2410 };
2411 suppress_msvc_warning(26475)//强制转换警告diss
2412 //npos
2413 //用以指定不存在的位置
2414 static constexpr size_t npos = size_t(-1);
2415 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2416 template<typename T>
2417 [[nodiscard]]constexpr T* in_range(T&pattern,array_like_view_t<T>range){
2418 for(auto&i : range){
2419 if(i==pattern)
2420 return addressof(i);
2421 }
2422 return nullptr;
2423 }
2424 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2425 template<typename T>
2426 [[nodiscard]]constexpr size_t in_range_size_t(T&pattern,array_like_view_t<T>range){
2427 auto result = in_range(pattern,range);
2428 if(result)
2429 return result - range.begin();
2430 else
2431 return npos;
2432 }
2433 //数据串匹配by steve02081504.
2434 //若成功找到匹配的数据串,返回其开头,若未找到,返回nullptr
2435 template<typename T>
2436 [[nodiscard]]constexpr T* in_range(array_like_view_t<T>pattern,array_like_view_t<T>range){
2437 if(range.size() >= 512 && pattern.size() >= 11){
2438 match_pattern tmp=pattern;
2439 return tmp.match(range);
2440 }
2441
2442 size_t off_set=0;
2443 size_t matching_off_set=1;
2444
2445 floop{
2446 matching_off_set=1;
2447 while(pattern.end()[0-matching_off_set]==range.begin()[off_set+pattern.size()-matching_off_set])
2448 if(matching_off_set==pattern.size())
2449 return addressof(range.begin()[off_set]);
2450 else
2451 matching_off_set++;
2452 if(off_set+pattern.size() >= range.size())
2453 return nullptr;
2454 auto tmp = in_range(range.begin()[off_set+pattern.size()], pattern);
2455 if(!tmp)
2456 tmp=pattern.begin();
2457 off_set+=pattern.end()-tmp;
2458 }
2459 }
2460 //若成功找到匹配的数据串,返回其距离开头的步数,若未找到,返回npos
2461 template<typename T>
2462 [[nodiscard]]constexpr size_t in_range_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2463 auto result = in_range(pattern,range);
2464 if(result)
2465 return result - range.begin();
2466 else
2467 return npos;
2468 }
2469 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2470 template<typename T>
2471 [[nodiscard]]constexpr T* in_range_but_reverse(T&pattern,array_like_view_t<T>range){
2472 for(auto&i : range|::std::views::reverse){
2473 if(i==pattern)
2474 return addressof(i);
2475 }
2476 return nullptr;
2477 }
2478 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2479 template<typename T>
2480 [[nodiscard]]constexpr size_t in_range_but_reverse_size_t(T&pattern,array_like_view_t<T>range){
2481 auto result = in_range_but_reverse(pattern,range);
2482 if(result)
2483 return result - range.begin();
2484 else
2485 return npos;
2486 }
2487 //反向数据串匹配by steve02081504.
2488 //若成功找到匹配的数据串,返回其开头,若未找到,返回nullptr
2489 template<typename T>
2491 if(range.size() >= 512 && pattern.size() >= 11){
2492 reverse_match_pattern tmp = pattern;
2493 return tmp.match(range);
2494 }
2495
2496 size_t off_set=0;
2497 size_t matching_off_set=0;
2498
2499 floop{
2500 matching_off_set=0;
2501 while(pattern.begin()[matching_off_set]==range.end()[0-(off_set+pattern.size()-matching_off_set)])
2502 if(matching_off_set==pattern.size()-1)
2503 return addressof(range.end()[0-(off_set+pattern.size())]);
2504 else
2505 matching_off_set++;
2506 if(off_set+pattern.size() >= range.size())
2507 return nullptr;
2508 auto tmp = in_range_but_reverse(range.end()[0-(off_set+pattern.size()+1)], pattern);
2509 if(!tmp)
2510 tmp=pattern.end()-1;
2511 off_set+=tmp-pattern.begin();
2512 off_set+=1;
2513 }
2514 }
2515 //若成功找到匹配的数据串,返回其距离开头的步数,若未找到,返回npos
2516 template<typename T>
2518 auto result = in_range_but_reverse(pattern,range);
2519 if(result)
2520 return result - range.begin();
2521 else
2522 return npos;
2523 }
2524
2525 //bitmark_for_finds
2526 //bitmark提供了一种快速进行四种泛搜索的实现,前提是构建中的pattern中的每一项的usigned表示都在一个字节(表长)内。
2527 //若bitmark构建失败,程序应当使用正在进行的泛搜索的朴素实现版本。
2528 template<typename T>
2530 typedef unsigned char index_type;
2531 bool _bitmark[number_of_possible_values_per<index_type>]{};
2532
2533 bitmark_for_finds()noexcept=default;
2534 [[nodiscard]]constexpr bool mark(array_like_view_t<T>pattern)noexcept{
2535 if constexpr(number_of_possible_values_per<T> > number_of_possible_values_per<index_type>){
2536 for(auto& i: pattern){
2537 if(::std::make_unsigned_t<T>(i) >= number_of_possible_values_per<index_type>)
2538 return false;
2539 _bitmark[index_type(i)] = true;
2540 }
2541 }
2542 else{
2543 for(auto& i: pattern)
2544 _bitmark[index_type(i)] = true;
2545 }
2546 return true;
2547 }
2548 [[nodiscard]]constexpr bool operator[](T&index)const noexcept{
2549 if constexpr(number_of_possible_values_per<T> > number_of_possible_values_per<index_type>)
2550 if(::std::make_unsigned_t<T>(index) >= number_of_possible_values_per<index_type>)
2551 return false;
2552 return _bitmark[index_type(index)];
2553 }
2554 };
2555 //find_first_of的bitmark实现
2556 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2557 template<typename T>
2558 [[nodiscard]]constexpr T* find_first_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2559 for(auto&i : range){
2560 if(mark[i])
2561 return addressof(i);
2562 }
2563 return nullptr;
2564 }
2565 //find_first_of的朴素实现
2566 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2567 template<typename T>
2568 [[nodiscard]]constexpr T* base_find_first_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2569 for(auto&i : range){
2570 if(in_range(i,pattern))
2571 return addressof(i);
2572 }
2573 return nullptr;
2574 }
2575 //find_first_of
2576 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2577 template<typename T>
2578 [[nodiscard]]constexpr T* find_first_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2579 if constexpr(::std::is_integral_v<T>){
2581 if(mark.mark(pattern))
2582 return find_first_of_bitmark(mark,range);
2583 }
2584 return base_find_first_of(pattern,range);
2585 }
2586 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2587 template<typename T>
2588 [[nodiscard]]constexpr size_t find_first_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2589 auto result = find_first_of(pattern,range);
2590 if(result)
2591 return result - range.begin();
2592 else
2593 return npos;
2594 }
2595 //find_last_of的bitmark实现
2596 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2597 template<typename T>
2598 [[nodiscard]]constexpr T* find_last_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2599 for(auto& i: range|::std::views::reverse){
2600 if(mark[i])
2601 return addressof(i);
2602 }
2603 }
2604 //find_last_of的朴素实现
2605 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2606 template<typename T>
2607 [[nodiscard]]constexpr T* base_find_last_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2608 for(auto&i : range|::std::views::reverse){
2609 if(in_range(i,pattern))
2610 return addressof(i);
2611 }
2612 return nullptr;
2613 }
2614 //find_last_of
2615 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2616 template<typename T>
2617 [[nodiscard]]constexpr T* find_last_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2618 if constexpr(::std::is_integral_v<T>){
2620 if(mark.mark(pattern))
2621 return find_last_of_bitmark(mark,range);
2622 }
2623 return base_find_last_of(pattern,range);
2624 }
2625 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2626 template<typename T>
2627 [[nodiscard]]constexpr size_t find_last_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2628 auto result = find_last_of(pattern,range);
2629 if(result)
2630 return result - range.begin();
2631 else
2632 return npos;
2633 }
2634 //find_first_not_of的bitmark实现
2635 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2636 template<typename T>
2637 [[nodiscard]]constexpr T* find_first_not_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2638 for(auto& i: range){
2639 if(!mark[i])
2640 return addressof(i);
2641 }
2642 return nullptr;
2643 }
2644 //find_first_not_of的朴素实现
2645 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2646 template<typename T>
2648 for(auto&i : range){
2649 if(!in_range(i,pattern))
2650 return addressof(i);
2651 }
2652 return nullptr;
2653 }
2654 //find_first_not_of
2655 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2656 template<typename T>
2657 [[nodiscard]]constexpr T* find_first_not_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2658 if constexpr(::std::is_integral_v<T>){
2660 if(mark.mark(pattern))
2661 return find_first_not_of_bitmark(mark,range);
2662 }
2663 return base_find_first_not_of(pattern,range);
2664 }
2665 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2666 template<typename T>
2667 [[nodiscard]]constexpr size_t find_first_not_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2668 auto result = find_first_not_of(pattern,range);
2669 if(result)
2670 return result - range.begin();
2671 else
2672 return npos;
2673 }
2674 //find_last_not_of的bitmark实现
2675 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2676 template<typename T>
2677 [[nodiscard]]constexpr T* find_last_not_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2678 for(auto& i: range|::std::views::reverse){
2679 if(!mark[i])
2680 return addressof(i);
2681 }
2682 return nullptr;
2683 }
2684 //find_last_not_of的朴素实现
2685 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2686 template<typename T>
2688 for(auto&i : range|::std::views::reverse){
2689 if(!in_range(i,pattern))
2690 return addressof(i);
2691 }
2692 return nullptr;
2693 }
2694 //find_last_not_of
2695 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2696 template<typename T>
2697 [[nodiscard]]constexpr T* find_last_not_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2698 if constexpr(::std::is_integral_v<T>){
2700 if(mark.mark(pattern))
2701 return find_last_not_of_bitmark(mark,range);
2702 }
2703 return base_find_last_not_of(pattern,range);
2704 }
2705 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2706 template<typename T>
2707 [[nodiscard]]constexpr size_t find_last_not_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2708 auto result = find_last_not_of(pattern,range);
2709 if(result)
2710 return result - range.begin();
2711 else
2712 return npos;
2713 }
2714 }
2715 using range_n::range_t;
2716 using range_n::in_range;
2724
2725 //file_end
2726
2727 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2728 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/string_view.hpp"
2729 //string_view.hpp
2730 //at namespace elc::defs::base
2731 /*
2732 未完成的elc解释器base_defs文件
2733 由steve02081504与Alex0125设计、编写
2734 转载时请在不对此文件做任何修改的同时注明出处
2735 项目地址:https://github.com/steve02081504/ELC
2736 */
2737 //仅是声明
2738 namespace constexpr_str_n {
2739 template<typename char_T>
2740 struct constexpr_str_t;
2741 }
2743 //重载range操作
2744 //仅是声明以及size_t包装
2745 namespace range_n {
2746 template<typename T>
2747 [[nodiscard]]constexpr T* in_range(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2748 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2749 template<typename T>
2750 [[nodiscard]]constexpr size_t in_range_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2751 auto result = in_range(pattern, range);
2752 if(result)
2753 return result - range.data();
2754 else
2755 return npos;
2756 }
2757 template<typename T>
2758 [[nodiscard]]constexpr T* in_range_but_reverse(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2759 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2760 template<typename T>
2761 [[nodiscard]]constexpr size_t in_range_but_reverse_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2762 auto result = in_range_but_reverse(pattern, range);
2763 if(result)
2764 return result - range.data();
2765 else
2766 return npos;
2767 }
2768 template<typename T>
2769 [[nodiscard]]constexpr T* find_first_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2770 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2771 template<typename T>
2772 [[nodiscard]]constexpr size_t find_first_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2773 auto result = find_first_of(pattern, range);
2774 if(result)
2775 return result - range.data();
2776 else
2777 return npos;
2778 }
2779 template<typename T>
2780 [[nodiscard]]constexpr T* find_last_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2781 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2782 template<typename T>
2783 [[nodiscard]]constexpr size_t find_last_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2784 auto result = find_last_of(pattern, range);
2785 if(result)
2786 return result - range.data();
2787 else
2788 return npos;
2789 }
2790 template<typename T>
2791 [[nodiscard]]constexpr T* find_first_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2792 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2793 template<typename T>
2794 [[nodiscard]]constexpr size_t find_first_not_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2795 auto result = find_first_not_of(pattern, range);
2796 if(result)
2797 return result - range.data();
2798 else
2799 return npos;
2800 }
2801 template<typename T>
2802 [[nodiscard]]constexpr T* find_last_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2803 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2804 template<typename T>
2805 [[nodiscard]]constexpr T* find_last_not_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2806 auto result = find_last_not_of(pattern,range);
2807 if(result)
2808 return result - range.begin();
2809 else
2810 return npos;
2811 }
2812 }
2813 //开始定义
2814 namespace string_view_n{
2815 //array_like_view_t的特化类型,表明这是字符串
2816 template<typename char_T>
2817 struct string_view_t:array_like_view_t<const char_T>{
2818 static constexpr size_t npos=range_n::npos;
2820 //构造函数
2821 using base_t::base_t;
2822 constexpr string_view_t(const char_T*str)noexcept:string_view_t(array_end_by_zero_t<const char_T>(str)){}
2823 //成员函数
2824 [[nodiscard]]constexpr const char_T*str()const noexcept{return base_t::cbegin();}
2825 [[nodiscard]]constexpr const char_T*data()const noexcept{return base_t::cbegin();}
2826 [[nodiscard]]constexpr operator const char_T*()const noexcept{return str();}
2827 //substr
2828 [[nodiscard]]constexpr string_view_t substr(size_t pos,size_t len)const noexcept{
2829 return string_view_t(base_t::cbegin()+pos,len);
2830 }
2831 [[nodiscard]]constexpr string_view_t substr(size_t pos)const noexcept{
2832 return string_view_t(base_t::cbegin()+pos,base_t::size()-pos);
2833 }
2834 [[nodiscard]]constexpr string_view_t substr(size_t pos,const char_T*end)const noexcept{
2835 return string_view_t(base_t::cbegin()+pos,end-base_t::cbegin());
2836 }
2837 [[nodiscard]]constexpr string_view_t substr(const char_T*begin,size_t len)const noexcept{
2838 return string_view_t(begin,len);
2839 }
2840 [[nodiscard]]constexpr string_view_t substr(const char_T*begin)const noexcept{
2841 return string_view_t(begin,base_t::size());
2842 }
2843 [[nodiscard]]constexpr string_view_t substr(const char_T*begin,const char_T*end)const noexcept{
2844 return string_view_t(begin,end-begin);
2845 }
2846 //find
2847 [[nodiscard]]constexpr size_t find(const char_T ch)const{
2848 return in_range_size_t(ch, *this);
2849 }
2850 [[nodiscard]]constexpr size_t reverse_find(const char_T ch)const{
2851 return in_range_but_reverse_size_t(ch, *this);
2852 }
2853 [[nodiscard]]constexpr size_t find(string_view_t str)const{
2854 return in_range_size_t(str, *this);
2855 }
2856 [[nodiscard]]constexpr size_t reverse_find(string_view_t str)const{
2857 return in_range_but_reverse_size_t(str, *this);
2858 }
2859 [[nodiscard]]constexpr size_t find(const constexpr_str_t<char_T>&str)const{
2860 return in_range_size_t(str, *this);
2861 }
2862 [[nodiscard]]constexpr size_t reverse_find(const constexpr_str_t<char_T>&str)const{
2863 return in_range_but_reverse_size_t(str, *this);
2864 }
2865 //others by range_n::find_last_of_size_t etc
2866 [[nodiscard]]constexpr size_t find_first_of(const char_T ch)const{
2867 return range_n::find_first_of_size_t(ch, *this);
2868 }
2869 [[nodiscard]]constexpr size_t find_last_of(const char_T ch)const{
2870 return range_n::find_last_of_size_t(ch, *this);
2871 }
2872 [[nodiscard]]constexpr size_t find_first_not_of(const char_T ch)const{
2873 return range_n::find_first_not_of_size_t(ch, *this);
2874 }
2875 [[nodiscard]]constexpr size_t find_last_not_of(const char_T ch)const{
2876 return range_n::find_last_not_of_size_t(ch, *this);
2877 }
2878 [[nodiscard]]constexpr size_t find_first_of(string_view_t str)const{
2879 return range_n::find_first_of_size_t(str, *this);
2880 }
2881 [[nodiscard]]constexpr size_t find_last_of(string_view_t str)const{
2882 return range_n::find_last_of_size_t(str, *this);
2883 }
2884 [[nodiscard]]constexpr size_t find_first_not_of(string_view_t str)const{
2885 return range_n::find_first_not_of_size_t(str, *this);
2886 }
2887 [[nodiscard]]constexpr size_t find_last_not_of(string_view_t str)const{
2888 return range_n::find_last_not_of_size_t(str, *this);
2889 }
2890 [[nodiscard]]constexpr size_t find_first_of(const constexpr_str_t<char_T>&str)const{
2891 return range_n::find_first_of_size_t(str, *this);
2892 }
2893 [[nodiscard]]constexpr size_t find_last_of(const constexpr_str_t<char_T>&str)const{
2894 return range_n::find_last_of_size_t(str, *this);
2895 }
2896 [[nodiscard]]constexpr size_t find_first_not_of(const constexpr_str_t<char_T>&str)const{
2897 return range_n::find_first_not_of_size_t(str, *this);
2898 }
2899 [[nodiscard]]constexpr size_t find_last_not_of(const constexpr_str_t<char_T>&str)const{
2900 return range_n::find_last_not_of_size_t(str, *this);
2901 }
2902 };
2904 }
2907
2908 //file_end
2909
2910 #line 32 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2911 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/type_name.hpp"
2912 //type_name.hpp
2913 //at namespace elc::defs::base
2914 /*
2915 未完成的elc解释器base_defs文件
2916 由steve02081504与Alex0125设计、编写
2917 转载时请在不对此文件做任何修改的同时注明出处
2918 项目地址:https://github.com/steve02081504/ELC
2919 */
2921 //对于gcc和clang,这个类型有一个malloced的char*,以便于在析构时释放
2922 //一切源于abi::__cxa_demangle
2923 //对于msvc,这个类型析构时不需要做任何事情
2925 //重整器包装
2926 static base_t demangle(const char*original_name)noexcept{
2927 push_and_disable_msvc_warning(26494);//未初始化警告diss
2928 size_t len;
2929 const char*demangled_name;
2931 #if defined(__clang__)||defined(__GNUC__)
2932 //gcc和clang
2933 //使用abi::__cxa_demangle重整
2934 int status;
2935 demangled_name=::abi::__cxa_demangle(original_name,nullptr,&len,&status);
2936 if(status!=0){
2937 demangled_name=original_name;
2938 len=::std::strlen(original_name);
2939 ::std::free((void*)demangled_name);
2940 }
2941 #else
2942 //msvc
2943 //不需要重整
2944 demangled_name=original_name;
2945 len=::std::strlen(original_name);
2946 #endif
2947 return base_t{demangled_name,len};
2948 }
2949 //复制重整结果
2950 static base_t copy_demangle(base_t demangled_name)noexcept{
2951 #if defined(__clang__)||defined(__GNUC__)
2952 //gcc和clang
2953 //需要复制重整结果(用malloced的char*)
2954 char*copyed_name=(char*)::std::malloc(demangled_name.size()+1);
2955 if(copyed_name==nullptr)
2956 return base_t{nullptr,0};
2957 ::std::memcpy(copyed_name,demangled_name.data(),demangled_name.size());
2958 copyed_name[demangled_name.size()]='\0';
2959 return base_t{copyed_name,demangled_name.size()};
2960 #else
2961 //msvc
2962 //不需要复制重整结果
2963 return demangled_name;
2964 #endif
2965 }
2966 //构造函数
2967 type_name_t(const char*original_name)noexcept:base_t(demangle(original_name)){}
2968 //复制构造函数
2969 type_name_t(const type_name_t&other)noexcept:base_t(copy_demangle(other)){}
2970 //移动构造函数(swap)
2971 type_name_t(type_name_t&&other)noexcept:base_t(nullptr,0){
2972 swap_with(other);
2973 }
2974 //析构函数
2975 ~type_name_t()noexcept{
2976 #if defined(__clang__)||defined(__GNUC__)
2977 //gcc和clang
2978 //需要释放malloced的char*
2979 ::std::free((void*)begin());
2980 #endif
2981 }
2982 };
2983 [[nodiscard]]inline type_name_t base_type_info_t::get_name()const noexcept{
2984 return _tid.get_name();
2985 }
2986 [[nodiscard]]inline type_name_t base_type_info_t::type_id_t::get_name()const noexcept{
2987 return _m->name();
2988 }
2989 template<typename T>
2990 [[nodiscard]]inline type_name_t type_info_t<T>::get_name()const noexcept{
2991 return base_type_info_t(*this).get_name();
2992 }
2993
2994 //file_end
2995
2996 #line 33 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2997 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/constexpr_str.hpp"
2998 //constexpr_str.hpp
2999 //at namespace elc::defs::base
3000 /*
3001 未完成的elc解释器base_defs文件
3002 由steve02081504与Alex0125设计、编写
3003 转载时请在不对此文件做任何修改的同时注明出处
3004 项目地址:https://github.com/steve02081504/ELC
3005 */
3006 namespace constexpr_str_n{
3007 //constexpr_str_t的退化类型,表明这是常量字符串,但没有可用的额外信息
3008 template<typename char_T>
3011 using base_t::base_t;
3012 constexpr_str_view_t(const char_T*str)noexcept=delete;
3013 //成员函数
3014 [[nodiscard]]constexpr const char_T*str()const noexcept{return base_t::cbegin();}
3015 [[nodiscard]]constexpr const char_T*data()const noexcept{return base_t::cbegin();}
3016 [[nodiscard]]constexpr operator const char_T*()const noexcept{return str();}
3017 //substr
3018 [[nodiscard]]constexpr constexpr_str_view_t substr(size_t pos,size_t len)const noexcept{
3019 return base_t::substr(pos,len);
3020 }
3021 [[nodiscard]]constexpr constexpr_str_view_t substr(size_t pos)const noexcept{
3022 return base_t::substr(pos);
3023 }
3024 [[nodiscard]]constexpr constexpr_str_view_t substr(size_t pos,const char_T*end)const noexcept{
3025 return base_t::substr(pos,end);
3026 }
3027 [[nodiscard]]constexpr constexpr_str_view_t substr(const char_T*begin,size_t len)const noexcept{
3028 return base_t::substr(begin,len);
3029 }
3030 [[nodiscard]]constexpr constexpr_str_view_t substr(const char_T*begin)const noexcept{
3031 return base_t::substr(begin);
3032 }
3033 [[nodiscard]]constexpr constexpr_str_view_t substr(const char_T*begin,const char_T*end)const noexcept{
3034 return base_t::substr(begin,end);
3035 }
3036 };
3037 //告知其他elc库接口这是编译时常量字符串,并提供编译时计算好的内容,包括但不限于hash、bmh头、bitmark等,用于加速库操作
3038 template<typename char_T>
3046 constexpr constexpr_str_t(const char_T* str, size_t size):
3047 base_t(str, size),
3048 hash_result(defs::hash(str, size)),
3049 match_pattern(array_like_view_t<const char_T>{str, size}),
3050 reverse_match_pattern(array_like_view_t<const char_T>{str, size}){
3051 is_bitmark_workable = bitmark_for_finds.mark(*this);
3052 }
3053 constexpr constexpr_str_t(const char_T* str):constexpr_str_t(str,array_end_by_zero_t::get_length_of(str)){}
3054 [[nodiscard]]constexpr hash_t hash()const noexcept{return hash_result;}
3055 };
3056 template<class char_T,size_t N>
3058 const char_T* _array_begin;
3059 constexpr constexpr_str_t_literal_helper(const char_T(&str)[N])noexcept{
3060 _array_begin=str;
3061 }
3062 [[nodiscard]]constexpr auto get_constexpr_str_t()const noexcept{
3063 return constexpr_str_t{_array_begin,N-1};
3064 }
3065 };
3066 template<constexpr_str_t_literal_helper v>
3068 distinctive static constexpr auto value = v.get_constexpr_str_t();
3069 };
3070 //别问,问就是傻逼c++
3071 //告知其他elc库接口这是编译时常量字符串,并提供编译时计算好的内容,包括但不限于hash、bmh头、bitmark等,用于加速库操作
3072 template<constexpr_str_t_literal_helper str_helper>
3073 [[nodiscard]]inline consteval auto& operator ""_constexpr_str()noexcept{
3075 }
3076 //空字串常量且str或begin会指向一个0终止字符串(而不是nullptr),便于安全初始化
3077 template<class char_T>
3078 distinctive inline constexpr auto empty_constexpr_str_of = constexpr_str_t(&const_default_value_of<char_T>,0);
3079 };
3083 using constexpr_str_n::operator ""_constexpr_str;
3084
3085 //重载range操作
3086 namespace range_n {
3087 template<typename T>
3088 [[nodiscard]]constexpr T* in_range(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3089 return pattern.match_pattern.match(range);
3090 }
3091 template<typename T>
3092 [[nodiscard]]constexpr T* in_range_but_reverse(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3093 return pattern.reverse_match_pattern.match(range);
3094 }
3095 //find_first_of
3096 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
3097 template<typename T>
3098 [[nodiscard]]constexpr T* find_first_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3099 if(pattern.is_bitmark_workable){
3100 return find_first_of_bitmark(pattern.bitmark_for_finds,range);
3101 }
3102 else{
3103 return find_first_of((const constexpr_str_view_t<T>&)pattern,range);
3104 }
3105 }
3106 //find_last_of
3107 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
3108 template<typename T>
3109 [[nodiscard]]constexpr T* find_last_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3110 if(pattern.is_bitmark_workable){
3111 return find_last_of_bitmark(pattern.bitmark_for_finds,range);
3112 }
3113 else{
3114 return find_last_of((const constexpr_str_view_t<T>&)pattern,range);
3115 }
3116 }
3117 //find_first_not_of
3118 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
3119 template<typename T>
3120 [[nodiscard]]constexpr T* find_first_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3121 if(pattern.is_bitmark_workable){
3122 return find_first_not_of_bitmark(pattern.bitmark_for_finds,range);
3123 }
3124 else{
3125 return find_first_not_of((const constexpr_str_view_t<T>&)pattern,range);
3126 }
3127 }
3128 //find_last_not_of
3129 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
3130 template<typename T>
3131 [[nodiscard]]constexpr T* find_last_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3132 if(pattern.is_bitmark_workable){
3133 return find_last_not_of_bitmark(pattern.bitmark_for_finds,range);
3134 }
3135 else{
3136 return find_last_not_of((const constexpr_str_view_t<T>&)pattern,range);
3137 }
3138 }
3139 };
3140
3141 //file_end
3142
3143 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3144 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/logical_bool.hpp"
3145 //logic.hpp
3146 //at namespace elc::defs::base
3147 /*
3148 未完成的elc解释器base_defs文件
3149 由steve02081504与Alex0125设计、编写
3150 转载时请在不对此文件做任何修改的同时注明出处
3151 项目地址:https://github.com/steve02081504/ELC
3152 */
3153
3154 /*
3155 logical_bool:混沌布尔值。
3156 允许输出介于真假之间的内容的布尔值。
3157 混沌布尔值会有五个可能的值,分别为true,false,neither,either。unknown视为不合法。
3158 用在if与while中时,true,either被判定为真,其与均为假。
3159 用法:
3160 logical_bool(bool) 输出logical_bool,将布尔值转换为混沌布尔值。
3161 bool(logical_bool) 输出bool,将混沌布尔值转化为布尔值。
3162 允许与或非运算:输出结果仍然为混沌布尔值,参与运算的值如果有unknown则均输出unknown.
3163 允许判定相等,输出结果为混沌布尔值,参与运算的值如果有unknown则均输出unknown,否则仅有true和false两个合法值。
3164 */
3165 /*
3166 在 虚伪 的 信 念 之 前 - 他 们 将 三 元 论 视 为 真理
3167 所 有 的 东西 都 是 三 部 分 。
3168 从 那里 , 他 们 终于 获得 了 答案 。
3169 */
3171 private:
3172 [[no_unique_address]]bool _is_true;
3173 [[no_unique_address]]bool _is_false;
3174 [[no_unique_address]]bool _is_unknown;
3175 public:
3176 constexpr logical_bool(special_init_t,bool is_true,bool is_false,bool is_unknown=0):_is_true(is_true),_is_false(is_false),_is_unknown(is_unknown){}
3177 constexpr logical_bool(bool a):_is_true(a),_is_false(!a),_is_unknown(0){}
3178 constexpr logical_bool(const logical_bool&)=default;
3179 constexpr logical_bool&operator=(const logical_bool&)& =default;
3180 constexpr explicit operator bool()const{return _is_true && !_is_unknown;}
3181 constexpr logical_bool operator!()const{
3182 logical_bool aret=*this;
3183 swap(aret._is_true,aret._is_false);
3184 return aret;
3185 }
3187 return logical_bool{special_init,a._is_true && b._is_true,a._is_false || b._is_false,a._is_unknown || b._is_unknown};
3188 }
3190 return logical_bool{special_init,a._is_true || b._is_true,a._is_false && b._is_false,a._is_unknown || b._is_unknown};
3191 }
3193 logical_bool aret(a._is_true == b._is_true && a._is_false == b._is_false);
3194 aret._is_unknown = a._is_unknown || b._is_unknown;
3195 return aret;
3196 }
3197 };
3199
3200 //file_end
3201
3202 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3203 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/zero.hpp"
3204 //zero.hpp
3205 //at namespace elc::defs::base
3206 /*
3207 未完成的elc解释器base_defs文件
3208 由steve02081504与Alex0125设计、编写
3209 转载时请在不对此文件做任何修改的同时注明出处
3210 项目地址:https://github.com/steve02081504/ELC
3211 */
3212 /*
3213 没什么用的语法糖,等价于字面量0.
3214 */
3215 constexpr struct zero_t{
3216 template<class T> requires(type_info<decltype(0)>.can_convert_to<T>)
3217 operator T()const noexcept(type_info<decltype(0)>.can_nothrow_convert_to<T>){return 0;}
3219
3220 template<class T>
3221 constexpr inline bool is_all_byte_zero(T&&a){
3222 const byte*ptr=cast_to_data(addressof(a));
3223 const byte*end=ptr+sizeof(a);
3224 while(ptr!=end)
3225 if((unsigned char)(*ptr++))
3226 return false;
3227 return true;
3228 }
3229
3230 //file_end
3231
3232 #line 36 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/count_able.hpp"
3234 //count_able.hpp
3235 //at namespace elc::defs::base
3236 /*
3237 未完成的elc解释器base_defs文件
3238 由steve02081504与Alex0125设计、编写
3239 转载时请在不对此文件做任何修改的同时注明出处
3240 项目地址:https://github.com/steve02081504/ELC
3241 */
3242 template<class T>
3243 [[nodiscard]]inline size_t the_number_of(type_info_t<T>)noexcept;
3244 template<class T>
3246 private:
3247 friend size_t the_number_of<T>(type_info_t<T>)noexcept;
3248 static size_t _number;
3249 public:
3250 count_able()noexcept{_number++;}
3251 ~count_able()noexcept{_number--;}
3252 };
3253 template<class T>
3254 [[nodiscard]]inline size_t the_number_of(type_info_t<T>)noexcept{
3255 if constexpr(type_info<T>.not_has_attribute(count_able))
3256 template_error("hey.");
3258 }
3259
3260 //file_end
3261
3262 #line 37 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3263 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/invoke.hpp"
3264 //invoke.hpp
3265 //at namespace elc::defs::base
3266 /*
3267 未完成的elc解释器base_defs文件
3268 由steve02081504与Alex0125设计、编写
3269 转载时请在不对此文件做任何修改的同时注明出处
3270 项目地址:https://github.com/steve02081504/ELC
3271 */
3272 template<typename T>
3273 struct invoke_t{
3274 template<class...Args>
3275 static constexpr bool able= ::std::is_invocable_v<T,Args...>;
3276 template<class...Args>
3277 static constexpr bool nothrow= ::std::is_nothrow_invocable_v<T,Args...>;
3278
3279 template<class...Args> requires able<Args...>
3280 auto _as(Args&&...rest)const noexcept(nothrow<Args...>){//invoke<T>._as(...)
3281 return lambda_with_catch(rest...)(const T&a)noexcept(nothrow<Args...>){return a(forward<Args>(rest)...);};
3282 }
3283 };
3284 template<typename T>
3286
3287 //file_end
3288
3289 #line 38 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3290 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/maybe_fail_reference.hpp"
3291 //maybe_fail_reference.hpp
3292 //at namespace elc::defs::base
3293 /*
3294 未完成的elc解释器base_defs文件
3295 由steve02081504与Alex0125设计、编写
3296 转载时请在不对此文件做任何修改的同时注明出处
3297 项目地址:https://github.com/steve02081504/ELC
3298 */
3299 template<typename T>
3301 T*_ref_to;
3302 public:
3303 constexpr maybe_fail_reference(T&a):_ref_to(&a){}
3305 constexpr maybe_fail_reference(note::fail_t):_ref_to(nullptr){}
3306
3307 [[nodiscard]]bool not_fail()noexcept{return _ref_to;}
3308 [[nodiscard]]bool fail()noexcept{return!not_fail();}
3309 T&get_ref()noexcept{return*_ref_to;}
3310 };
3311
3312 //file_end
3313
3314 #line 39 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3315
3316 //file_end
3317
3318 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
3319 }
3320
3321 //由于vcruntime的type_info在全局定义,这里需要额外声明使用base::type_info.
3322 #if defined(_VCRUNTIME_H)
3323 using base::type_info;
3324 #endif
3325
3326 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
3327 //_undefs.hpp
3328 /*
3329 未完成的elc解释器basic文件
3330 由steve02081504与Alex0125设计、编写
3331 转载时请在不对此文件做任何修改的同时注明出处
3332 项目地址:https://github.com/steve02081504/ELC
3333 */
3334 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
3335 //_undefs.hpp
3336 /*
3337 未完成的elc解释器_share文件
3338 由steve02081504与Alex0125设计、编写
3339 转载时请在不对此文件做任何修改的同时注明出处
3340 项目地址:https://github.com/steve02081504/ELC
3341 */
3342
3343 //defs at "_defs.hpp"
3344
3345 #if defined(_MSC_VER)
3346 #pragma warning(pop)
3347 #endif
3348 #undef suppress_msvc_warning
3349 #undef disable_msvc_warning
3350 #undef push_msvc_warning
3351 #undef pop_msvc_warning
3352 #undef push_and_disable_msvc_warning
3353
3354 //for basic_environment.hpp
3355 #undef BIT_POSSIBILITY
3356 //
3357 #if defined(ELC_VOID_NAME)
3358 #define void the_void
3359 #endif
3360
3361 // #undef often_noexcept
3362 #undef noexcept_as
3363 #undef noexcept_as_auto
3364 #undef constexpr_as
3365 #undef constexpr_as_auto
3366
3367 #undef using_method_from_base_t
3368 #undef using_method_from_value
3369
3370 #undef floop
3371 #undef enable_adl
3372
3373 #undef re_declvalue
3374 #undef re_decltype
3375
3376 #undef declvalue
3377
3378 #undef template_error
3379 #undef template_warning
3380
3381 #undef type_info_of
3382 #undef type_name_of
3383
3384 #undef is_common_attribute
3385 #undef is_special_attribute
3386
3387 #undef has_attribute
3388 #undef not_has_attribute
3389
3390 #undef float_size_of
3391 #undef bitnum_of
3392
3393 #undef def_common_attribute_with_nothing
3394 #undef def_special_attribute_with_nothing
3395
3396 #undef common_attribute_t
3397 #undef special_attribute_t
3398
3399 #undef enable_if
3400 #undef enabled_by_default
3401 #undef disabled_by_default
3402 #undef enable_if_not_ill_form
3403 #undef enable_flag
3404
3405 #undef was_an_ill_form
3406 #undef was_an_ill_form_with_parameter
3407 #undef was_not_an_ill_form
3408 #undef was_not_an_ill_form_and_noexcept
3409 #undef was_not_an_ill_form_with_parameter
3410
3411 #undef recursive_lambda
3412 #undef get_recursive_lambda_caller
3413 #undef lambda
3414 #undef lambda_with_catch
3415 #undef self_recursion
3416 #undef lambda_RLSRRS
3417
3418 #undef MAGIC
3419
3420 #undef nothing
3421
3422 #undef elseif
3423 #undef _big_than_
3424 #undef _small_than_
3425
3426 #if defined(_MSC_VER)
3427 #undef not
3428 #undef and
3429 #undef or
3430 #endif
3431
3432 #undef INTER_NAMESPACE
3433 #undef BREAK_NAMESPACE
3434
3435 #undef szie
3436 #undef form
3437
3438 #undef template_name
3439 #undef type_name
3440
3441 #undef not_in_debug
3442
3443 #undef es
3444 #undef ec
3445
3446 #undef ELC_TEST_EVENTNAME
3447
3448 #undef override_instance_struct
3449
3450 #undef distinctive
3451
3452 #undef force_inline
3453
3454 #undef with_no_vtable
3455
3456 #undef in_consteval
3457
3458 #undef no_vtable_struct
3459 #undef no_vtable_class
3460
3461 //file_end
3462
3463 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
3464
3465 //file_end
3466
3467 #line 38 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
3468 }
3469
3470 //file_end
3471
3472 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
3473 #endif
3474
3475 //file_end
3476
3477 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
3478 #include <cstring>//memcpy、memmove
3479 #include <atomic>//atomic
3480 #if defined(ELC_TEST_ON)
3481 #include <ctime>//time
3482 #endif
3483 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
3484 //_body.hpp
3485 //at namespace ::
3486 /*
3487 未完成的elc解释器base文件
3488 由steve02081504与Alex0125设计、编写
3489 转载时请在不对此文件做任何修改的同时注明出处
3490 项目地址:https://github.com/steve02081504/ELC
3491 */
3492 #if defined(ELC_TEST)//若已包含elc/test则报错:其应在此文件后被包含
3493 #error "this part cannot be tested."
3494 #endif
3495
3496 //include APIs:elc中可能根据编译环境而修改的底层函数
3497 //using at memory/alloc
3498 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3499 //alloc.hpp
3500 /*
3501 未完成的elc解释器_share文件
3502 由steve02081504与Alex0125设计、编写
3503 转载时请在不对此文件做任何修改的同时注明出处
3504 项目地址:https://github.com/steve02081504/ELC
3505 */
3506 /*
3507 APIs说明
3508 elc依赖的基础函数.
3509 调整这些,实现快速移植,快速优化与行为自定义.
3510 */
3511 #if !defined(ELC_APIS_alloc)
3512 #define ELC_APIS_alloc
3513 #if defined(ELC_MEMORY_ALLOC_LOCATION_RECORD)
3514 #include <stacktrace>//for operate_source_location
3515 #endif
3516 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/decl_system_type.hpp"
3517 //decl_system_type.hpp
3518 /*
3519 未完成的elc解释器_share文件
3520 由steve02081504与Alex0125设计、编写
3521 转载时请在不对此文件做任何修改的同时注明出处
3522 项目地址:https://github.com/steve02081504/ELC
3523 */
3524 //copy&rewrite from steve02081504/steve.h
3525 #define linux 2
3526 #define windows 3
3527 #define other 4
3528 #if defined(__linux)||defined(__linux__)||defined(__gnu_linux__)
3529 #define SYSTEM_TYPE linux
3530 #elif defined(_WIN32)||defined(__MINGW32__)||defined(__CYGWIN__)
3531 #define SYSTEM_TYPE windows
3532 #else
3533 #define SYSTEM_TYPE other
3534 #endif
3535 #define ERROR_MSG_UNABLE_OS "Unable OS,edit this file on your own or contact ELC's producers."
3536
3537 //file_end
3538
3539 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3540 #if SYSTEM_TYPE == windows
3541 #if defined(_DEBUG)
3542 #include <crtdbg.h>
3543 #else
3544 #include <malloc.h>
3545 #endif
3546 #else
3547 #include <cstdlib>
3548 #endif
3549 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
3550 //base_defs
3551 //at namespace ::
3552 /*
3553 未完成的elc解释器include文件
3554 由steve02081504与Alex0125设计、编写
3555 转载时请在不对此文件做任何修改的同时注明出处
3556 项目地址:https://github.com/steve02081504/ELC
3557 */
3558 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
3559
3560 //file_end
3561
3562 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3564 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
3565 //_defs.hpp
3566 /*
3567 未完成的elc解释器_share文件
3568 由steve02081504与Alex0125设计、编写
3569 转载时请在不对此文件做任何修改的同时注明出处
3570 项目地址:https://github.com/steve02081504/ELC
3571 */
3572
3573 //undefs at "_undefs.hpp"
3574
3575 //set ELC_WARNING_LEVEL default to 4(max)
3576 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
3577
3578 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
3579 //basic_environment.hpp
3580 /*
3581 未完成的elc解释器_share文件
3582 由steve02081504与Alex0125设计、编写
3583 转载时请在不对此文件做任何修改的同时注明出处
3584 项目地址:https://github.com/steve02081504/ELC
3585 */
3586
3587 //每个bit(不是字节)的可能性
3588 //为什么c艹委员会不定义这个?
3589 #define BIT_POSSIBILITY 2
3590
3591 //file_end
3592
3593 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
3594
3595 #if defined(_MSC_VER)
3596 #pragma warning(push,ELC_WARNING_LEVEL)
3597 #pragma warning(disable:4099)//class与struct混用警告diss
3598 #pragma warning(disable:26812)//enum class安利diss.
3599 #pragma warning(disable:4584)//重复子类警告diss
3600 #pragma warning(disable:4250)//域控制继承警告diss
3601 #pragma warning(disable:26432)//不完全默认方法警告diss
3602 #pragma warning(disable:26435)//virtual override方法警告diss
3603 #pragma warning(disable:26481)//容器安利diss
3604 #pragma warning(disable:26446)//gsl::at安利diss
3605 #pragma warning(disable:26434)//方法覆盖警告diss
3606 #pragma warning(disable:26429)//gsl::not_null安利diss
3607 #pragma warning(disable:26471)//对void*进行static_cast安利diss
3608 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
3609 #pragma warning(disable:26473)//相同指针显式cast警告diss
3610 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
3611 #pragma warning(disable:26485)//数组作指针警告diss
3612 #pragma warning(disable:26490)//reinterpret_cast警告diss
3613 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
3614 #pragma warning(disable:26482)//非常数数组索引警告diss
3615 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
3616 #endif
3617 #if defined(_MSC_VER)
3618 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
3619 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
3620 #define push_msvc_warning() __pragma(warning(push))
3621 #define pop_msvc_warning() __pragma(warning(pop))
3622 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
3623 #else
3624 #define suppress_msvc_warning(...)
3625 #define disable_msvc_warning(...)
3626 #define push_msvc_warning()
3627 #define pop_msvc_warning()
3628 #define push_and_disable_msvc_warning(...)
3629 #endif
3630 //
3631 #if defined(ELC_VOID_NAME)
3632 #undef void
3633 #endif
3634
3635 // #define often_noexcept
3636 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
3637 #define noexcept_as_auto MAGIC//哦现在有了
3638 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
3639 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
3640
3641 #define using_method_from_base_t(name,...) \
3642 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
3643 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
3644 {\
3645 return base_t::name(forward<Args>(rest)...);\
3646 }\
3647
3648 #define using_method_from_value(name,value_name,...) \
3649 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
3650 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
3651 {\
3652 return value_name.name(forward<Args>(rest)...);\
3653 }\
3654
3655 #define floop while(__builtin_is_my_dick_still_there())
3656 #define enable_adl(name) void name()noexcept=delete
3657
3658 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
3659 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
3660
3661 #define declvalue(...) (::std::declval<__VA_ARGS__>())
3662
3663 /*实例化到此将引发错误*/
3664 #define template_error(reason) static_assert(template_error_helper<T>,reason)
3665 /*实例化到此将引发警告*/
3666 #define template_warning(reason) template_warning_helper<T>(reason)
3667
3668 //for type_info
3669 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
3670 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
3671
3672 #define is_common_attribute(name) public attribute<T,name<T>>
3673 #define is_special_attribute(name) public attribute<T,name>
3674
3675 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
3676 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
3677
3678 //for float_size_t
3679 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
3680 //bitnum_of
3681 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
3682
3683 //for attribute
3684 #define def_common_attribute_with_nothing(name) \
3685 template<typename T>\
3686 class name{}\
3687
3688 #define def_special_attribute_with_nothing(name) \
3689 class name{}\
3690
3691 #define common_attribute_t template<class>class
3692 #define special_attribute_t class
3693
3694 /*
3695 若参数的布尔值为零,那么此模板不会实例化
3696
3697 为什么不用cpp20的constraints?
3698 1.不能类内定义
3699 2.不能作为模板参数
3700 一句话总结:c艹标准会sb
3701 */
3702 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
3703 /*默认参与模板候选*/
3704 #define enabled_by_default class enable_state=void
3705 /*默认不参与模板候选*/
3706 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
3707 /*若参数为病式,那么此模板不会实例化*/
3708 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
3709 /*用于模板声明*/
3710 #define enable_flag class enable_state
3711
3712 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
3713 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
3714 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
3715 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
3716 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
3717
3718 /*让lambda递归更加美观*/
3719 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
3720 /*让lambda递归更加美观*/
3721 #define get_recursive_lambda_caller(name) \
3722 lambda_with_catch(&)(auto&&...Args){\
3723 return name(name,Args...);\
3724 }
3725 /*让lambda定义更加美观*/
3726 #define lambda []
3727 /*让lambda定义更加美观*/
3728 #define lambda_with_catch(...) [__VA_ARGS__]
3729 /*让lambda递归更加美观*/
3730 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
3731 //recursive_lambda_self_referential_reserved_symbolname
3732 #define lambda_RLSRRS _my_jb_super_sb_name_
3733
3734 #define MAGIC//ahh,ko no tenno da!
3735
3736 /*装饰性语法糖*/
3737 #define nothing
3738
3739 /*aya风格语法糖*/
3740 #define elseif else if
3741 /*aya风格语法糖*/
3742 #define _big_than_ >
3743 /*aya风格语法糖*/
3744 #define _small_than_ <
3745
3746 #if defined(_MSC_VER)
3747 #define not !
3748 #define and &&
3749 #define or ||
3750 #endif
3751
3752 /*进入名称空间,并不是很美观*/
3753 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
3754 /*退出名称空间,并不是很美观*/
3755 #define BREAK_NAMESPACE }
3756
3757 /*template说明符*/
3758 #define template_name template
3759 /*template说明符*/
3760 #define type_name class
3761
3762 #if defined(DEBUG) || defined(_DEBUG)
3763 #define not_in_debug 0
3764 #else
3765 #define not_in_debug 1
3766 #endif
3767
3768 #define es U""
3769 #define ec(ch) U ## ch
3770
3771 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
3772 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
3773 #else
3774 #define ELC_TEST_EVENTNAME(name)
3775 #endif
3776
3777 #define override_instance_struct \
3778 protected:\
3779 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
3780 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
3781 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
3782 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
3783 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
3784
3785 #if defined(_WIN32)
3786 #define distinctive __declspec(dllexport)
3787 #else
3788 #define distinctive
3789 #endif
3790
3791 #if defined(_WIN32)
3792 #define force_inline __forceinline
3793 #elif defined(__GNUC__)
3794 #define force_inline __attribute__((always_inline)) inline
3795 #else
3796 #define force_inline inline
3797 #endif
3798
3799 #if defined(_WIN32)
3800 #define with_no_vtable __declspec(novtable)
3801 #else
3802 #define with_no_vtable
3803 #endif
3804
3805 #define in_consteval (::std::is_constant_evaluated())
3806
3807 #define no_vtable_struct struct with_no_vtable
3808 #define no_vtable_class class with_no_vtable
3809
3810 //file_end
3811
3812 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3813
3814 using namespace ::elc::defs;//remove_const||byte
3815 #if SYSTEM_TYPE != windows
3816 //overhead
3817 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc/default_method/overhead.hpp"
3818 //overhead.hpp
3819 //at namespace elc::APIs::alloc
3820 /*
3821 未完成的elc解释器base文件
3822 由steve02081504与Alex0125设计、编写
3823 转载时请在不对此文件做任何修改的同时注明出处
3824 项目地址:https://github.com/steve02081504/ELC
3825 */
3826 namespace overhead_n{
3827 using namespace ::elc::defs;
3828 constexpr size_t overhead_get_align(size_t align){
3829 return max(align,alignof(size_t));//保证最高对齐需求
3830 }
3831 constexpr size_t overhead_get_offset_value(size_t align){
3832 align=overhead_get_align(align);
3833 return (size_t(sizeof(size_t)/align)+bool(sizeof(size_t)%align))*align;//等同于sizeof(size_t)-sizeof(size_t)%align+(sizeof(size_t)%align?align:0)
3834 //暨,偏移量既要大于sizeof(size_t)以装下overhead,又要是align的整数倍以保证T实例的对齐被满足
3835 }
3836 constexpr size_t correct_size(size_t size,size_t align){
3837 return size+overhead_get_offset_value(align);
3838 }
3839 constexpr size_t correct_align(size_t align){
3840 return overhead_get_align(align);
3841 }
3842 inline pointer correct_pointer(pointer a,size_t align){
3843 return apply_off_set(a,overhead_get_offset_value(align));
3844 }
3845 inline pointer recorrect_pointer(pointer a,size_t align){
3846 return unapply_off_set(a,overhead_get_offset_value(align));
3847 }
3848 inline const_pointer recorrect_pointer(const_pointer a, size_t align){
3849 return unapply_off_set(a,overhead_get_offset_value(align));
3850 }
3851 inline void set_overhead(pointer a,size_t size){
3852 *reinterpret_cast<size_t*>(a)=size;
3853 }
3854 inline size_t get_overhead(const_pointer a){
3855 return*reinterpret_cast<const size_t*>(a);
3856 }
3857 }
3858
3859 //file_end
3860
3861 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3862 #endif
3863 //operate_source_location & source_location_guard
3864 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc/debug_info/source_location_guard.hpp"
3865 //source_location_guard.hpp
3866 //at namespace elc::APIs::alloc
3867 /*
3868 未完成的elc解释器base文件
3869 由steve02081504与Alex0125设计、编写
3870 转载时请在不对此文件做任何修改的同时注明出处
3871 项目地址:https://github.com/steve02081504/ELC
3872 */
3873 #if defined(_MSC_VER)
3874 #if defined(ELC_MEMORY_ALLOC_LOCATION_RECORD)
3875 #pragma detect_mismatch("ELC_MEMORY_ALLOC_LOCATION_RECORD","true")
3876 #else
3877 #pragma detect_mismatch("ELC_MEMORY_ALLOC_LOCATION_RECORD","false")
3878 #endif
3879 #endif
3880 #if defined(ELC_MEMORY_ALLOC_LOCATION_RECORD)
3881 distinctive inline ::std::stacktrace_entry operate_source_frame;
3882 distinctive inline struct source_location_info_t{
3883 const char*_file=nullptr;
3884 uint_least32_t _line=0;
3885 const char*file()noexcept{
3886 if(!_file){
3887 try{
3888 static ::std::string file_cache;
3889 file_cache=operate_source_frame.source_file();
3890 _file=file_cache.c_str();
3891 }
3892 catch(...){
3893 }
3894 }
3895 return _file;
3896 }
3897 uint_least32_t line()noexcept{
3898 if(!_line){
3899 try{
3900 _line=operate_source_frame.source_line();
3901 }
3902 catch(...){
3903 }
3904 }
3905 return _line;
3906 }
3907 void clear()noexcept{
3908 _file=nullptr;
3909 _line=0;
3910 }
3912 struct source_location_guard{
3913 bool is_set=false;
3914 source_location_guard(size_t lookup=0)noexcept{
3915 if(!operate_source_frame){
3916 ::std::stacktrace stack = ::std::stacktrace::current(/*skip*/lookup+2,/*max_depth*/1);
3917 if(stack.size()){
3918 operate_source_frame = stack[0];
3919 is_set = true;
3920 }
3921 }
3922 }
3923 ~source_location_guard()noexcept{
3924 if(is_set){
3925 operate_source_frame = ::std::stacktrace_entry{};
3927 }
3928 }
3929 };
3930 #else
3932 constexpr source_location_guard([[maybe_unused]]size_t lookup=0)noexcept{}
3933 };
3935 constexpr const char*file()noexcept{return nullptr;}
3936 constexpr uint_least32_t line()noexcept{return 0;}
3937 }operate_source_location;
3938 #endif
3939
3940 //file_end
3941
3942 #line 36 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3943
3944 //BLOCK: Counting memory allocations
3945 #if defined(_MSC_VER)
3946 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
3947 #pragma detect_mismatch("ELC_TEST_COUNT_MEMORY_ALLOC","true")
3948 #else
3949 #pragma detect_mismatch("ELC_TEST_COUNT_MEMORY_ALLOC","false")
3950 #endif
3951 #endif
3952
3953 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
3954 [[nodiscard]]inline size_t get_size_of_alloc(const byte*p,size_t align)noexcept;
3955 namespace count_info{
3956 distinctive inline size_t alloc_count=0;
3957 distinctive inline size_t free_count=0;
3958 distinctive inline size_t alloc_size=0;
3959 distinctive inline size_t free_size=0;
3960 distinctive inline size_t memory_using=0;
3961 distinctive inline size_t memory_using_max=0;
3962 inline void update_memory_using(ptrdiff_t diff)noexcept{
3963 memory_using+=diff;
3964 if(memory_using>memory_using_max)
3965 memory_using_max=memory_using;
3966 }
3967 inline void clear()noexcept{
3968 alloc_count=0;
3969 free_count=0;
3970 alloc_size=0;
3971 free_size=0;
3972 memory_using=0;
3973 memory_using_max=0;
3974 }
3975 }
3976 #endif
3977 //BLOCK_END
3978
3979 /*
3980 aligned_alloc 内存分配函数,需提供对齐需求
3981 return空指针被允许
3982 size被保证不为0
3983 */
3984 [[nodiscard]]inline byte*aligned_alloc(size_t align,size_t size)noexcept{
3985 void* aret;//返回值放这里
3986
3987 #if SYSTEM_TYPE == windows
3988 #if defined(_DEBUG)
3989 aret = _aligned_malloc_dbg(size,align,operate_source_location.file(),operate_source_location.line());
3990 #else
3991 aret = _aligned_malloc(size,align);
3992 #endif
3993 #else
3994 using namespace overhead_n;
3995 void*tmp=::std::aligned_alloc(correct_align(align),correct_size(size,align));
3996 if(tmp){
3997 set_overhead(tmp,size);
3998 aret = correct_pointer(tmp,align);
3999 }
4000 else
4001 aret = nullptr;
4002 #endif
4003
4004 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4005 if(aret){
4006 count_info::alloc_count++;
4007 count_info::alloc_size+=size;
4008 count_info::update_memory_using(size);
4009 }
4010 #endif
4011
4012 return(byte*)aret;
4013 }
4014 /*
4015 realloc 重新规划分配的大小
4016 return空指针被允许,但ptr值必须保持有效以保证gc后再次realloc有效
4017 new_size被保证不为0
4018 align维持不变
4019 但只允许在扩大数据块时可选的移动数据块
4020 */
4021 [[nodiscard]]inline byte*realloc(byte*ptr,size_t nsize,[[maybe_unused]]size_t align)noexcept{
4022 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4023 const auto osize=get_size_of_alloc(ptr,align);
4024 #endif
4025 void* aret;//返回值放这里
4026
4027 #if SYSTEM_TYPE == windows
4028 #if defined(_DEBUG)
4029 aret = _aligned_realloc_dbg(ptr,nsize,align,operate_source_location.file(),operate_source_location.line());
4030 #else
4031 aret = _aligned_realloc(ptr,nsize,align);
4032 #endif
4033 #else
4034 using namespace overhead_n;
4035 void*tmp=::std::realloc(recorrect_pointer(ptr,align),correct_size(nsize,align));
4036 if(tmp){
4037 set_overhead(tmp,nsize);
4038 aret = correct_pointer(tmp,align);
4039 }
4040 else
4041 aret = nullptr;
4042 #endif
4043
4044 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4045 if(aret){
4046 count_info::alloc_size+=nsize-osize;
4047 count_info::update_memory_using(nsize-osize);
4048 }
4049 #endif
4050
4051 return(byte*)aret;
4052 }
4053 /*
4054 free 释放所分配的内存
4055 传入需获取大小的数据块起始点与对齐
4056 */
4057 inline void free(byte*p,[[maybe_unused]]size_t align)noexcept{
4058 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4059 const auto size=get_size_of_alloc(p,align);
4060 count_info::free_count++;
4061 count_info::free_size+=size;
4062 count_info::update_memory_using(-ptrdiff_t(size));
4063 #endif
4064
4065 #if SYSTEM_TYPE == windows
4066 #if defined(_DEBUG)
4067 _aligned_free_dbg(p);
4068 #else
4069 _aligned_free(p);
4070 #endif
4071 #else
4072 using namespace overhead_n;
4073 ::std::free(recorrect_pointer(p,align));
4074 #endif
4075 }
4076 /*
4077 get_size_of_alloc 获取数据块的大小
4078 传入需获取大小的数据块起始点与对齐
4079 */
4080 [[nodiscard]]inline size_t get_size_of_alloc(const byte*p,[[maybe_unused]]size_t align)noexcept{
4081 #if SYSTEM_TYPE == windows
4082 #if defined(_DEBUG)
4083 return _aligned_msize_dbg(remove_const(p),align,0);
4084 #else
4085 return _aligned_msize(remove_const(p),align,0);
4086 #endif
4087 #else
4088 using namespace overhead_n;
4089 return get_overhead(recorrect_pointer(p,align));
4090 #endif
4091 }
4092
4093 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
4094 //_undefs.hpp
4095 /*
4096 未完成的elc解释器_share文件
4097 由steve02081504与Alex0125设计、编写
4098 转载时请在不对此文件做任何修改的同时注明出处
4099 项目地址:https://github.com/steve02081504/ELC
4100 */
4101
4102 //defs at "_defs.hpp"
4103
4104 #if defined(_MSC_VER)
4105 #pragma warning(pop)
4106 #endif
4107 #undef suppress_msvc_warning
4108 #undef disable_msvc_warning
4109 #undef push_msvc_warning
4110 #undef pop_msvc_warning
4111 #undef push_and_disable_msvc_warning
4112
4113 //for basic_environment.hpp
4114 #undef BIT_POSSIBILITY
4115 //
4116 #if defined(ELC_VOID_NAME)
4117 #define void the_void
4118 #endif
4119
4120 // #undef often_noexcept
4121 #undef noexcept_as
4122 #undef noexcept_as_auto
4123 #undef constexpr_as
4124 #undef constexpr_as_auto
4125
4126 #undef using_method_from_base_t
4127 #undef using_method_from_value
4128
4129 #undef floop
4130 #undef enable_adl
4131
4132 #undef re_declvalue
4133 #undef re_decltype
4134
4135 #undef declvalue
4136
4137 #undef template_error
4138 #undef template_warning
4139
4140 #undef type_info_of
4141 #undef type_name_of
4142
4143 #undef is_common_attribute
4144 #undef is_special_attribute
4145
4146 #undef has_attribute
4147 #undef not_has_attribute
4148
4149 #undef float_size_of
4150 #undef bitnum_of
4151
4152 #undef def_common_attribute_with_nothing
4153 #undef def_special_attribute_with_nothing
4154
4155 #undef common_attribute_t
4156 #undef special_attribute_t
4157
4158 #undef enable_if
4159 #undef enabled_by_default
4160 #undef disabled_by_default
4161 #undef enable_if_not_ill_form
4162 #undef enable_flag
4163
4164 #undef was_an_ill_form
4165 #undef was_an_ill_form_with_parameter
4166 #undef was_not_an_ill_form
4167 #undef was_not_an_ill_form_and_noexcept
4168 #undef was_not_an_ill_form_with_parameter
4169
4170 #undef recursive_lambda
4171 #undef get_recursive_lambda_caller
4172 #undef lambda
4173 #undef lambda_with_catch
4174 #undef self_recursion
4175 #undef lambda_RLSRRS
4176
4177 #undef MAGIC
4178
4179 #undef nothing
4180
4181 #undef elseif
4182 #undef _big_than_
4183 #undef _small_than_
4184
4185 #if defined(_MSC_VER)
4186 #undef not
4187 #undef and
4188 #undef or
4189 #endif
4190
4191 #undef INTER_NAMESPACE
4192 #undef BREAK_NAMESPACE
4193
4194 #undef szie
4195 #undef form
4196
4197 #undef template_name
4198 #undef type_name
4199
4200 #undef not_in_debug
4201
4202 #undef es
4203 #undef ec
4204
4205 #undef ELC_TEST_EVENTNAME
4206
4207 #undef override_instance_struct
4208
4209 #undef distinctive
4210
4211 #undef force_inline
4212
4213 #undef with_no_vtable
4214
4215 #undef in_consteval
4216
4217 #undef no_vtable_struct
4218 #undef no_vtable_class
4219
4220 //file_end
4221
4222 #line 187 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
4223 }
4224 //
4225 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/undef_decl_system_type.hpp"
4226 //undef_decl_system_type.hpp
4227 /*
4228 未完成的elc解释器_share文件
4229 由steve02081504与Alex0125设计、编写
4230 转载时请在不对此文件做任何修改的同时注明出处
4231 项目地址:https://github.com/steve02081504/ELC
4232 */
4233 //copy&rewrite from steve02081504/evest.h
4234 #undef linux
4235 #undef windows
4236 #undef other
4237 #undef SYSTEM_TYPE
4238 #undef ERROR_MSG_UNABLE_OS
4239
4240 //file_end
4241
4242 #line 190 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
4243 #endif
4244
4245 //file_end
4246
4247 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
4248 //using at memory/gc
4249 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4250 //die.hpp
4251 /*
4252 未完成的elc解释器_share文件
4253 由steve02081504与Alex0125设计、编写
4254 转载时请在不对此文件做任何修改的同时注明出处
4255 项目地址:https://github.com/steve02081504/ELC
4256 */
4257 /*
4258 APIs说明
4259 elc依赖的基础函数.
4260 调整这些,实现快速移植,快速优化与行为自定义.
4261 */
4262 #if !defined(ELC_APIS_die)
4263 #define ELC_APIS_die
4264 #include <cuchar>
4265 #include <clocale>
4266 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
4267 //default_data_type.hpp
4268 /*
4269 未完成的elc解释器_share文件
4270 由steve02081504与Alex0125设计、编写
4271 转载时请在不对此文件做任何修改的同时注明出处
4272 项目地址:https://github.com/steve02081504/ELC
4273 */
4274 namespace elc{
4275 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
4276 typedef char32_t char_t;
4277 /*ELC内部钦定int_t类型*/
4278 typedef int64_t int_t;
4279 /*ELC内部钦定uint_t类型*/
4280 typedef uint64_t uint_t;
4281 /*ELC内部钦定float_t类型*/
4282 typedef double float_t;
4283 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
4284 typedef long double float_size_t;
4285 }
4286
4287 //file_end
4288
4289 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4291 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4292 //_defs.hpp
4293 /*
4294 未完成的elc解释器_share文件
4295 由steve02081504与Alex0125设计、编写
4296 转载时请在不对此文件做任何修改的同时注明出处
4297 项目地址:https://github.com/steve02081504/ELC
4298 */
4299
4300 //undefs at "_undefs.hpp"
4301
4302 //set ELC_WARNING_LEVEL default to 4(max)
4303 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4304
4305 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
4306 //basic_environment.hpp
4307 /*
4308 未完成的elc解释器_share文件
4309 由steve02081504与Alex0125设计、编写
4310 转载时请在不对此文件做任何修改的同时注明出处
4311 项目地址:https://github.com/steve02081504/ELC
4312 */
4313
4314 //每个bit(不是字节)的可能性
4315 //为什么c艹委员会不定义这个?
4316 #define BIT_POSSIBILITY 2
4317
4318 //file_end
4319
4320 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4321
4322 #if defined(_MSC_VER)
4323 #pragma warning(push,ELC_WARNING_LEVEL)
4324 #pragma warning(disable:4099)//class与struct混用警告diss
4325 #pragma warning(disable:26812)//enum class安利diss.
4326 #pragma warning(disable:4584)//重复子类警告diss
4327 #pragma warning(disable:4250)//域控制继承警告diss
4328 #pragma warning(disable:26432)//不完全默认方法警告diss
4329 #pragma warning(disable:26435)//virtual override方法警告diss
4330 #pragma warning(disable:26481)//容器安利diss
4331 #pragma warning(disable:26446)//gsl::at安利diss
4332 #pragma warning(disable:26434)//方法覆盖警告diss
4333 #pragma warning(disable:26429)//gsl::not_null安利diss
4334 #pragma warning(disable:26471)//对void*进行static_cast安利diss
4335 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
4336 #pragma warning(disable:26473)//相同指针显式cast警告diss
4337 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
4338 #pragma warning(disable:26485)//数组作指针警告diss
4339 #pragma warning(disable:26490)//reinterpret_cast警告diss
4340 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
4341 #pragma warning(disable:26482)//非常数数组索引警告diss
4342 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
4343 #endif
4344 #if defined(_MSC_VER)
4345 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
4346 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
4347 #define push_msvc_warning() __pragma(warning(push))
4348 #define pop_msvc_warning() __pragma(warning(pop))
4349 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
4350 #else
4351 #define suppress_msvc_warning(...)
4352 #define disable_msvc_warning(...)
4353 #define push_msvc_warning()
4354 #define pop_msvc_warning()
4355 #define push_and_disable_msvc_warning(...)
4356 #endif
4357 //
4358 #if defined(ELC_VOID_NAME)
4359 #undef void
4360 #endif
4361
4362 // #define often_noexcept
4363 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
4364 #define noexcept_as_auto MAGIC//哦现在有了
4365 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
4366 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
4367
4368 #define using_method_from_base_t(name,...) \
4369 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
4370 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
4371 {\
4372 return base_t::name(forward<Args>(rest)...);\
4373 }\
4374
4375 #define using_method_from_value(name,value_name,...) \
4376 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
4377 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
4378 {\
4379 return value_name.name(forward<Args>(rest)...);\
4380 }\
4381
4382 #define floop while(__builtin_is_my_dick_still_there())
4383 #define enable_adl(name) void name()noexcept=delete
4384
4385 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
4386 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
4387
4388 #define declvalue(...) (::std::declval<__VA_ARGS__>())
4389
4390 /*实例化到此将引发错误*/
4391 #define template_error(reason) static_assert(template_error_helper<T>,reason)
4392 /*实例化到此将引发警告*/
4393 #define template_warning(reason) template_warning_helper<T>(reason)
4394
4395 //for type_info
4396 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
4397 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
4398
4399 #define is_common_attribute(name) public attribute<T,name<T>>
4400 #define is_special_attribute(name) public attribute<T,name>
4401
4402 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
4403 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
4404
4405 //for float_size_t
4406 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
4407 //bitnum_of
4408 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
4409
4410 //for attribute
4411 #define def_common_attribute_with_nothing(name) \
4412 template<typename T>\
4413 class name{}\
4414
4415 #define def_special_attribute_with_nothing(name) \
4416 class name{}\
4417
4418 #define common_attribute_t template<class>class
4419 #define special_attribute_t class
4420
4421 /*
4422 若参数的布尔值为零,那么此模板不会实例化
4423
4424 为什么不用cpp20的constraints?
4425 1.不能类内定义
4426 2.不能作为模板参数
4427 一句话总结:c艹标准会sb
4428 */
4429 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
4430 /*默认参与模板候选*/
4431 #define enabled_by_default class enable_state=void
4432 /*默认不参与模板候选*/
4433 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
4434 /*若参数为病式,那么此模板不会实例化*/
4435 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
4436 /*用于模板声明*/
4437 #define enable_flag class enable_state
4438
4439 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
4440 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
4441 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
4442 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
4443 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
4444
4445 /*让lambda递归更加美观*/
4446 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
4447 /*让lambda递归更加美观*/
4448 #define get_recursive_lambda_caller(name) \
4449 lambda_with_catch(&)(auto&&...Args){\
4450 return name(name,Args...);\
4451 }
4452 /*让lambda定义更加美观*/
4453 #define lambda []
4454 /*让lambda定义更加美观*/
4455 #define lambda_with_catch(...) [__VA_ARGS__]
4456 /*让lambda递归更加美观*/
4457 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
4458 //recursive_lambda_self_referential_reserved_symbolname
4459 #define lambda_RLSRRS _my_jb_super_sb_name_
4460
4461 #define MAGIC//ahh,ko no tenno da!
4462
4463 /*装饰性语法糖*/
4464 #define nothing
4465
4466 /*aya风格语法糖*/
4467 #define elseif else if
4468 /*aya风格语法糖*/
4469 #define _big_than_ >
4470 /*aya风格语法糖*/
4471 #define _small_than_ <
4472
4473 #if defined(_MSC_VER)
4474 #define not !
4475 #define and &&
4476 #define or ||
4477 #endif
4478
4479 /*进入名称空间,并不是很美观*/
4480 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
4481 /*退出名称空间,并不是很美观*/
4482 #define BREAK_NAMESPACE }
4483
4484 /*template说明符*/
4485 #define template_name template
4486 /*template说明符*/
4487 #define type_name class
4488
4489 #if defined(DEBUG) || defined(_DEBUG)
4490 #define not_in_debug 0
4491 #else
4492 #define not_in_debug 1
4493 #endif
4494
4495 #define es U""
4496 #define ec(ch) U ## ch
4497
4498 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
4499 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
4500 #else
4501 #define ELC_TEST_EVENTNAME(name)
4502 #endif
4503
4504 #define override_instance_struct \
4505 protected:\
4506 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
4507 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
4508 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
4509 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
4510 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
4511
4512 #if defined(_WIN32)
4513 #define distinctive __declspec(dllexport)
4514 #else
4515 #define distinctive
4516 #endif
4517
4518 #if defined(_WIN32)
4519 #define force_inline __forceinline
4520 #elif defined(__GNUC__)
4521 #define force_inline __attribute__((always_inline)) inline
4522 #else
4523 #define force_inline inline
4524 #endif
4525
4526 #if defined(_WIN32)
4527 #define with_no_vtable __declspec(novtable)
4528 #else
4529 #define with_no_vtable
4530 #endif
4531
4532 #define in_consteval (::std::is_constant_evaluated())
4533
4534 #define no_vtable_struct struct with_no_vtable
4535 #define no_vtable_class class with_no_vtable
4536
4537 //file_end
4538
4539 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4540
4541 [[noreturn]]inline void die()noexcept{
4542 #if defined(_MSC_VER)
4543 __debugbreak();
4544 #endif
4545 #if defined(_WINMAIN_)
4546 ::MessageBoxW(NULL,L"elc died.",NULL,MB_ICONERROR);
4547 #else
4548 ::std::fputs("elc died.\n",stderr);
4549 ::std::fflush(stderr);
4550 #endif
4551 ::std::abort();
4552 }
4553 [[noreturn]]inline void die_with(const char_t*err_msg)noexcept{
4554 #if defined(_MSC_VER)
4555 __debugbreak();
4556 #endif
4558 26485//数组转型警告diss
4559 26475//强转警告diss
4560 26481//指针操作警告diss
4561 26429//nullness警告diss
4562 )
4563 if(err_msg){
4564 ::std::mbstate_t stat{};
4565 if(::std::setlocale(LC_CTYPE,"en_US.utf8")==nullptr)
4566 die();
4567 push_and_disable_msvc_warning(26494);//未初始化警告diss
4568 char err_msg_in_char[2048];
4569 char* err_msg_write = err_msg_in_char;
4570 size_t s;
4571 char_t c;
4573 floop{
4574 c=*err_msg++;
4575 if(c==0)
4576 break;
4577 s = ::std::c32rtomb(err_msg_write, c, &stat);
4578 if(s == size_t(-1))
4579 die();
4580 err_msg_write += s;
4581 }
4582 *err_msg_write = '\0';
4583 #if defined(_WINMAIN_)
4584 wchar_t err_msg_in_wchar[2048];
4585 MultiByteToWideChar(CP_UTF8, 0, err_msg_in_char, -1, err_msg_in_wchar, 2048);
4586 ::MessageBoxW(NULL,err_msg_in_wchar,NULL,MB_ICONERROR);
4587 #else
4588 ::std::fputs("elc died because:\n",stderr);
4589 ::std::fputs(err_msg_in_char,stderr);
4590 ::std::fputc('\n',stderr);
4591 ::std::fflush(stderr);
4592 #endif
4593 }
4594 ::std::abort();
4596 }
4597
4598 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
4599 //_undefs.hpp
4600 /*
4601 未完成的elc解释器_share文件
4602 由steve02081504与Alex0125设计、编写
4603 转载时请在不对此文件做任何修改的同时注明出处
4604 项目地址:https://github.com/steve02081504/ELC
4605 */
4606
4607 //defs at "_defs.hpp"
4608
4609 #if defined(_MSC_VER)
4610 #pragma warning(pop)
4611 #endif
4612 #undef suppress_msvc_warning
4613 #undef disable_msvc_warning
4614 #undef push_msvc_warning
4615 #undef pop_msvc_warning
4616 #undef push_and_disable_msvc_warning
4617
4618 //for basic_environment.hpp
4619 #undef BIT_POSSIBILITY
4620 //
4621 #if defined(ELC_VOID_NAME)
4622 #define void the_void
4623 #endif
4624
4625 // #undef often_noexcept
4626 #undef noexcept_as
4627 #undef noexcept_as_auto
4628 #undef constexpr_as
4629 #undef constexpr_as_auto
4630
4631 #undef using_method_from_base_t
4632 #undef using_method_from_value
4633
4634 #undef floop
4635 #undef enable_adl
4636
4637 #undef re_declvalue
4638 #undef re_decltype
4639
4640 #undef declvalue
4641
4642 #undef template_error
4643 #undef template_warning
4644
4645 #undef type_info_of
4646 #undef type_name_of
4647
4648 #undef is_common_attribute
4649 #undef is_special_attribute
4650
4651 #undef has_attribute
4652 #undef not_has_attribute
4653
4654 #undef float_size_of
4655 #undef bitnum_of
4656
4657 #undef def_common_attribute_with_nothing
4658 #undef def_special_attribute_with_nothing
4659
4660 #undef common_attribute_t
4661 #undef special_attribute_t
4662
4663 #undef enable_if
4664 #undef enabled_by_default
4665 #undef disabled_by_default
4666 #undef enable_if_not_ill_form
4667 #undef enable_flag
4668
4669 #undef was_an_ill_form
4670 #undef was_an_ill_form_with_parameter
4671 #undef was_not_an_ill_form
4672 #undef was_not_an_ill_form_and_noexcept
4673 #undef was_not_an_ill_form_with_parameter
4674
4675 #undef recursive_lambda
4676 #undef get_recursive_lambda_caller
4677 #undef lambda
4678 #undef lambda_with_catch
4679 #undef self_recursion
4680 #undef lambda_RLSRRS
4681
4682 #undef MAGIC
4683
4684 #undef nothing
4685
4686 #undef elseif
4687 #undef _big_than_
4688 #undef _small_than_
4689
4690 #if defined(_MSC_VER)
4691 #undef not
4692 #undef and
4693 #undef or
4694 #endif
4695
4696 #undef INTER_NAMESPACE
4697 #undef BREAK_NAMESPACE
4698
4699 #undef szie
4700 #undef form
4701
4702 #undef template_name
4703 #undef type_name
4704
4705 #undef not_in_debug
4706
4707 #undef es
4708 #undef ec
4709
4710 #undef ELC_TEST_EVENTNAME
4711
4712 #undef override_instance_struct
4713
4714 #undef distinctive
4715
4716 #undef force_inline
4717
4718 #undef with_no_vtable
4719
4720 #undef in_consteval
4721
4722 #undef no_vtable_struct
4723 #undef no_vtable_class
4724
4725 //file_end
4726
4727 #line 78 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4728 }
4729 namespace elc::defs{
4730 using namespace elc::APIs::die;
4731 }
4732 #endif
4733
4734 //file_end
4735
4736 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
4737 //include locale:自然语言相关的字符串
4738 //strings
4739 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4740 //using.hpp
4741 /*
4742 未完成的elc解释器_share文件
4743 由steve02081504与Alex0125设计、编写
4744 转载时请在不对此文件做任何修改的同时注明出处
4745 项目地址:https://github.com/steve02081504/ELC
4746 */
4747 /*
4748 locale说明
4749 elc使用的字符串.
4750 调整这些,实现快速本地化.
4751 */
4752 #if !defined(ELC_LOCALE)
4753 #define ELC_LOCALE
4754 #include <locale>
4755 //
4756 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
4757 //default_data_type.hpp
4758 /*
4759 未完成的elc解释器_share文件
4760 由steve02081504与Alex0125设计、编写
4761 转载时请在不对此文件做任何修改的同时注明出处
4762 项目地址:https://github.com/steve02081504/ELC
4763 */
4764 namespace elc{
4765 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
4766 typedef char32_t char_t;
4767 /*ELC内部钦定int_t类型*/
4768 typedef int64_t int_t;
4769 /*ELC内部钦定uint_t类型*/
4770 typedef uint64_t uint_t;
4771 /*ELC内部钦定float_t类型*/
4772 typedef double float_t;
4773 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
4774 typedef long double float_size_t;
4775 }
4776
4777 //file_end
4778
4779 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4780 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/_char.hpp"
4781 //_char.hpp
4782 /*
4783 未完成的elc解释器_share文件
4784 由steve02081504与Alex0125设计、编写
4785 转载时请在不对此文件做任何修改的同时注明出处
4786 项目地址:https://github.com/steve02081504/ELC
4787 */
4789 inline const ::std::locale default_locale{"en_US.utf8"};
4790 namespace char_n{
4791 template <class charT> bool isspace (charT c){ return isspace (c,default_locale); }
4792 template <class charT> bool isprint (charT c){ return isprint (c,default_locale); }
4793 template <class charT> bool iscntrl (charT c){ return iscntrl (c,default_locale); }
4794 template <class charT> bool isupper (charT c){ return isupper (c,default_locale); }
4795 template <class charT> bool islower (charT c){ return islower (c,default_locale); }
4796 template <class charT> bool isalpha (charT c){ return isalpha (c,default_locale); }
4797 template <class charT> bool isdigit (charT c){ return isdigit (c,default_locale); }
4798 template <class charT> bool ispunct (charT c){ return ispunct (c,default_locale); }
4799 template <class charT> bool isxdigit(charT c){ return isxdigit(c,default_locale); }
4800 template <class charT> bool isalnum (charT c){ return isalnum (c,default_locale); }
4801 template <class charT> bool isgraph (charT c){ return isgraph (c,default_locale); }
4802 template <class charT> charT toupper(charT c){ return toupper (c,default_locale); }
4803 template <class charT> charT tolower(charT c){ return tolower (c,default_locale); }
4804 }
4805 }
4806
4807 //file_end
4808
4809 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4810 //
4811 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
4812 //base_defs
4813 //at namespace ::
4814 /*
4815 未完成的elc解释器include文件
4816 由steve02081504与Alex0125设计、编写
4817 转载时请在不对此文件做任何修改的同时注明出处
4818 项目地址:https://github.com/steve02081504/ELC
4819 */
4820 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
4821
4822 //file_end
4823
4824 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4825 //
4826 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4827 //_defs.hpp
4828 /*
4829 未完成的elc解释器_share文件
4830 由steve02081504与Alex0125设计、编写
4831 转载时请在不对此文件做任何修改的同时注明出处
4832 项目地址:https://github.com/steve02081504/ELC
4833 */
4834
4835 //undefs at "_undefs.hpp"
4836
4837 //set ELC_WARNING_LEVEL default to 4(max)
4838 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4839
4840 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
4841 //basic_environment.hpp
4842 /*
4843 未完成的elc解释器_share文件
4844 由steve02081504与Alex0125设计、编写
4845 转载时请在不对此文件做任何修改的同时注明出处
4846 项目地址:https://github.com/steve02081504/ELC
4847 */
4848
4849 //每个bit(不是字节)的可能性
4850 //为什么c艹委员会不定义这个?
4851 #define BIT_POSSIBILITY 2
4852
4853 //file_end
4854
4855 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4856
4857 #if defined(_MSC_VER)
4858 #pragma warning(push,ELC_WARNING_LEVEL)
4859 #pragma warning(disable:4099)//class与struct混用警告diss
4860 #pragma warning(disable:26812)//enum class安利diss.
4861 #pragma warning(disable:4584)//重复子类警告diss
4862 #pragma warning(disable:4250)//域控制继承警告diss
4863 #pragma warning(disable:26432)//不完全默认方法警告diss
4864 #pragma warning(disable:26435)//virtual override方法警告diss
4865 #pragma warning(disable:26481)//容器安利diss
4866 #pragma warning(disable:26446)//gsl::at安利diss
4867 #pragma warning(disable:26434)//方法覆盖警告diss
4868 #pragma warning(disable:26429)//gsl::not_null安利diss
4869 #pragma warning(disable:26471)//对void*进行static_cast安利diss
4870 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
4871 #pragma warning(disable:26473)//相同指针显式cast警告diss
4872 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
4873 #pragma warning(disable:26485)//数组作指针警告diss
4874 #pragma warning(disable:26490)//reinterpret_cast警告diss
4875 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
4876 #pragma warning(disable:26482)//非常数数组索引警告diss
4877 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
4878 #endif
4879 #if defined(_MSC_VER)
4880 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
4881 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
4882 #define push_msvc_warning() __pragma(warning(push))
4883 #define pop_msvc_warning() __pragma(warning(pop))
4884 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
4885 #else
4886 #define suppress_msvc_warning(...)
4887 #define disable_msvc_warning(...)
4888 #define push_msvc_warning()
4889 #define pop_msvc_warning()
4890 #define push_and_disable_msvc_warning(...)
4891 #endif
4892 //
4893 #if defined(ELC_VOID_NAME)
4894 #undef void
4895 #endif
4896
4897 // #define often_noexcept
4898 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
4899 #define noexcept_as_auto MAGIC//哦现在有了
4900 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
4901 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
4902
4903 #define using_method_from_base_t(name,...) \
4904 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
4905 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
4906 {\
4907 return base_t::name(forward<Args>(rest)...);\
4908 }\
4909
4910 #define using_method_from_value(name,value_name,...) \
4911 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
4912 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
4913 {\
4914 return value_name.name(forward<Args>(rest)...);\
4915 }\
4916
4917 #define floop while(__builtin_is_my_dick_still_there())
4918 #define enable_adl(name) void name()noexcept=delete
4919
4920 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
4921 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
4922
4923 #define declvalue(...) (::std::declval<__VA_ARGS__>())
4924
4925 /*实例化到此将引发错误*/
4926 #define template_error(reason) static_assert(template_error_helper<T>,reason)
4927 /*实例化到此将引发警告*/
4928 #define template_warning(reason) template_warning_helper<T>(reason)
4929
4930 //for type_info
4931 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
4932 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
4933
4934 #define is_common_attribute(name) public attribute<T,name<T>>
4935 #define is_special_attribute(name) public attribute<T,name>
4936
4937 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
4938 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
4939
4940 //for float_size_t
4941 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
4942 //bitnum_of
4943 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
4944
4945 //for attribute
4946 #define def_common_attribute_with_nothing(name) \
4947 template<typename T>\
4948 class name{}\
4949
4950 #define def_special_attribute_with_nothing(name) \
4951 class name{}\
4952
4953 #define common_attribute_t template<class>class
4954 #define special_attribute_t class
4955
4956 /*
4957 若参数的布尔值为零,那么此模板不会实例化
4958
4959 为什么不用cpp20的constraints?
4960 1.不能类内定义
4961 2.不能作为模板参数
4962 一句话总结:c艹标准会sb
4963 */
4964 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
4965 /*默认参与模板候选*/
4966 #define enabled_by_default class enable_state=void
4967 /*默认不参与模板候选*/
4968 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
4969 /*若参数为病式,那么此模板不会实例化*/
4970 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
4971 /*用于模板声明*/
4972 #define enable_flag class enable_state
4973
4974 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
4975 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
4976 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
4977 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
4978 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
4979
4980 /*让lambda递归更加美观*/
4981 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
4982 /*让lambda递归更加美观*/
4983 #define get_recursive_lambda_caller(name) \
4984 lambda_with_catch(&)(auto&&...Args){\
4985 return name(name,Args...);\
4986 }
4987 /*让lambda定义更加美观*/
4988 #define lambda []
4989 /*让lambda定义更加美观*/
4990 #define lambda_with_catch(...) [__VA_ARGS__]
4991 /*让lambda递归更加美观*/
4992 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
4993 //recursive_lambda_self_referential_reserved_symbolname
4994 #define lambda_RLSRRS _my_jb_super_sb_name_
4995
4996 #define MAGIC//ahh,ko no tenno da!
4997
4998 /*装饰性语法糖*/
4999 #define nothing
5000
5001 /*aya风格语法糖*/
5002 #define elseif else if
5003 /*aya风格语法糖*/
5004 #define _big_than_ >
5005 /*aya风格语法糖*/
5006 #define _small_than_ <
5007
5008 #if defined(_MSC_VER)
5009 #define not !
5010 #define and &&
5011 #define or ||
5012 #endif
5013
5014 /*进入名称空间,并不是很美观*/
5015 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
5016 /*退出名称空间,并不是很美观*/
5017 #define BREAK_NAMESPACE }
5018
5019 /*template说明符*/
5020 #define template_name template
5021 /*template说明符*/
5022 #define type_name class
5023
5024 #if defined(DEBUG) || defined(_DEBUG)
5025 #define not_in_debug 0
5026 #else
5027 #define not_in_debug 1
5028 #endif
5029
5030 #define es U""
5031 #define ec(ch) U ## ch
5032
5033 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
5034 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
5035 #else
5036 #define ELC_TEST_EVENTNAME(name)
5037 #endif
5038
5039 #define override_instance_struct \
5040 protected:\
5041 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
5042 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
5043 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
5044 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
5045 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
5046
5047 #if defined(_WIN32)
5048 #define distinctive __declspec(dllexport)
5049 #else
5050 #define distinctive
5051 #endif
5052
5053 #if defined(_WIN32)
5054 #define force_inline __forceinline
5055 #elif defined(__GNUC__)
5056 #define force_inline __attribute__((always_inline)) inline
5057 #else
5058 #define force_inline inline
5059 #endif
5060
5061 #if defined(_WIN32)
5062 #define with_no_vtable __declspec(novtable)
5063 #else
5064 #define with_no_vtable
5065 #endif
5066
5067 #define in_consteval (::std::is_constant_evaluated())
5068
5069 #define no_vtable_struct struct with_no_vtable
5070 #define no_vtable_class class with_no_vtable
5071
5072 //file_end
5073
5074 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
5075 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/zh_cn.hpp"
5076 //zh_cn.hpp
5077 /*
5078 未完成的elc解释器_share文件
5079 由steve02081504与Alex0125设计、编写
5080 转载时请在不对此文件做任何修改的同时注明出处
5081 项目地址:https://github.com/steve02081504/ELC
5082 */
5083 /*
5084 locale说明
5085 elc使用的字符串.
5086 调整这些,实现快速本地化.
5087 */
5089
5090 }
5092 inline namespace gc{
5093 inline constexpr auto gc_fail=es"gc失败"_constexpr_str;
5094 inline constexpr auto empty_gc_method=es"gc方法为空时gc被调用"_constexpr_str;
5095 }
5096 inline namespace code_convert{
5097 inline constexpr auto setlocale_error=es"setlocale出错"_constexpr_str;
5098 inline constexpr auto code_convert_error=es"编码转换出错"_constexpr_str;
5099 }
5100 inline namespace lib_load{
5101 inline constexpr auto null_lib=es"访问null处的lib对象"_constexpr_str;
5102 }
5103 inline namespace exception{
5104 inline constexpr auto unknow_error=es"未知错误"_constexpr_str;
5105 inline constexpr auto core_runtime_internal_helper_leak=es"未知错误"_constexpr_str;
5106 }
5107 inline namespace base_read{
5108 inline constexpr auto ending_of_expr_beyond_expectations=es"表达式的结尾超出预期"_constexpr_str;
5109 inline constexpr auto expr_incomplete=es"表达式未完成"_constexpr_str;
5110 inline constexpr auto symbol_is_undefined=es"此符号未定义"_constexpr_str;
5111 inline constexpr auto expr_too_outrageous=es"表达式过于离谱"_constexpr_str;
5112 }
5113 inline namespace package_symbol_loader{
5114 inline constexpr auto load_failed=es"无法加载的package_symbol_loader"_constexpr_str;
5115 inline constexpr auto load_interface_failed=es"package_symbol_loader缺失load_interface"_constexpr_str;
5116 }
5117 }
5118
5119 //file_end
5120
5121 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
5122 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
5123 //_undefs.hpp
5124 /*
5125 未完成的elc解释器_share文件
5126 由steve02081504与Alex0125设计、编写
5127 转载时请在不对此文件做任何修改的同时注明出处
5128 项目地址:https://github.com/steve02081504/ELC
5129 */
5130
5131 //defs at "_defs.hpp"
5132
5133 #if defined(_MSC_VER)
5134 #pragma warning(pop)
5135 #endif
5136 #undef suppress_msvc_warning
5137 #undef disable_msvc_warning
5138 #undef push_msvc_warning
5139 #undef pop_msvc_warning
5140 #undef push_and_disable_msvc_warning
5141
5142 //for basic_environment.hpp
5143 #undef BIT_POSSIBILITY
5144 //
5145 #if defined(ELC_VOID_NAME)
5146 #define void the_void
5147 #endif
5148
5149 // #undef often_noexcept
5150 #undef noexcept_as
5151 #undef noexcept_as_auto
5152 #undef constexpr_as
5153 #undef constexpr_as_auto
5154
5155 #undef using_method_from_base_t
5156 #undef using_method_from_value
5157
5158 #undef floop
5159 #undef enable_adl
5160
5161 #undef re_declvalue
5162 #undef re_decltype
5163
5164 #undef declvalue
5165
5166 #undef template_error
5167 #undef template_warning
5168
5169 #undef type_info_of
5170 #undef type_name_of
5171
5172 #undef is_common_attribute
5173 #undef is_special_attribute
5174
5175 #undef has_attribute
5176 #undef not_has_attribute
5177
5178 #undef float_size_of
5179 #undef bitnum_of
5180
5181 #undef def_common_attribute_with_nothing
5182 #undef def_special_attribute_with_nothing
5183
5184 #undef common_attribute_t
5185 #undef special_attribute_t
5186
5187 #undef enable_if
5188 #undef enabled_by_default
5189 #undef disabled_by_default
5190 #undef enable_if_not_ill_form
5191 #undef enable_flag
5192
5193 #undef was_an_ill_form
5194 #undef was_an_ill_form_with_parameter
5195 #undef was_not_an_ill_form
5196 #undef was_not_an_ill_form_and_noexcept
5197 #undef was_not_an_ill_form_with_parameter
5198
5199 #undef recursive_lambda
5200 #undef get_recursive_lambda_caller
5201 #undef lambda
5202 #undef lambda_with_catch
5203 #undef self_recursion
5204 #undef lambda_RLSRRS
5205
5206 #undef MAGIC
5207
5208 #undef nothing
5209
5210 #undef elseif
5211 #undef _big_than_
5212 #undef _small_than_
5213
5214 #if defined(_MSC_VER)
5215 #undef not
5216 #undef and
5217 #undef or
5218 #endif
5219
5220 #undef INTER_NAMESPACE
5221 #undef BREAK_NAMESPACE
5222
5223 #undef szie
5224 #undef form
5225
5226 #undef template_name
5227 #undef type_name
5228
5229 #undef not_in_debug
5230
5231 #undef es
5232 #undef ec
5233
5234 #undef ELC_TEST_EVENTNAME
5235
5236 #undef override_instance_struct
5237
5238 #undef distinctive
5239
5240 #undef force_inline
5241
5242 #undef with_no_vtable
5243
5244 #undef in_consteval
5245
5246 #undef no_vtable_struct
5247 #undef no_vtable_class
5248
5249 //file_end
5250
5251 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
5252 //
5253 #endif
5254
5255 //file_end
5256
5257 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
5258
5259 namespace elc::defs{ //在elc::defs中定义内容
5260 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
5261 //_defs.hpp
5262 /*
5263 未完成的elc解释器basic文件
5264 由steve02081504与Alex0125设计、编写
5265 转载时请在不对此文件做任何修改的同时注明出处
5266 项目地址:https://github.com/steve02081504/ELC
5267 */
5268 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
5269 //_defs.hpp
5270 /*
5271 未完成的elc解释器_share文件
5272 由steve02081504与Alex0125设计、编写
5273 转载时请在不对此文件做任何修改的同时注明出处
5274 项目地址:https://github.com/steve02081504/ELC
5275 */
5276
5277 //undefs at "_undefs.hpp"
5278
5279 //set ELC_WARNING_LEVEL default to 4(max)
5280 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
5281
5282 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
5283 //basic_environment.hpp
5284 /*
5285 未完成的elc解释器_share文件
5286 由steve02081504与Alex0125设计、编写
5287 转载时请在不对此文件做任何修改的同时注明出处
5288 项目地址:https://github.com/steve02081504/ELC
5289 */
5290
5291 //每个bit(不是字节)的可能性
5292 //为什么c艹委员会不定义这个?
5293 #define BIT_POSSIBILITY 2
5294
5295 //file_end
5296
5297 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
5298
5299 #if defined(_MSC_VER)
5300 #pragma warning(push,ELC_WARNING_LEVEL)
5301 #pragma warning(disable:4099)//class与struct混用警告diss
5302 #pragma warning(disable:26812)//enum class安利diss.
5303 #pragma warning(disable:4584)//重复子类警告diss
5304 #pragma warning(disable:4250)//域控制继承警告diss
5305 #pragma warning(disable:26432)//不完全默认方法警告diss
5306 #pragma warning(disable:26435)//virtual override方法警告diss
5307 #pragma warning(disable:26481)//容器安利diss
5308 #pragma warning(disable:26446)//gsl::at安利diss
5309 #pragma warning(disable:26434)//方法覆盖警告diss
5310 #pragma warning(disable:26429)//gsl::not_null安利diss
5311 #pragma warning(disable:26471)//对void*进行static_cast安利diss
5312 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
5313 #pragma warning(disable:26473)//相同指针显式cast警告diss
5314 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
5315 #pragma warning(disable:26485)//数组作指针警告diss
5316 #pragma warning(disable:26490)//reinterpret_cast警告diss
5317 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
5318 #pragma warning(disable:26482)//非常数数组索引警告diss
5319 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
5320 #endif
5321 #if defined(_MSC_VER)
5322 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
5323 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
5324 #define push_msvc_warning() __pragma(warning(push))
5325 #define pop_msvc_warning() __pragma(warning(pop))
5326 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
5327 #else
5328 #define suppress_msvc_warning(...)
5329 #define disable_msvc_warning(...)
5330 #define push_msvc_warning()
5331 #define pop_msvc_warning()
5332 #define push_and_disable_msvc_warning(...)
5333 #endif
5334 //
5335 #if defined(ELC_VOID_NAME)
5336 #undef void
5337 #endif
5338
5339 // #define often_noexcept
5340 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
5341 #define noexcept_as_auto MAGIC//哦现在有了
5342 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
5343 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
5344
5345 #define using_method_from_base_t(name,...) \
5346 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
5347 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
5348 {\
5349 return base_t::name(forward<Args>(rest)...);\
5350 }\
5351
5352 #define using_method_from_value(name,value_name,...) \
5353 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
5354 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
5355 {\
5356 return value_name.name(forward<Args>(rest)...);\
5357 }\
5358
5359 #define floop while(__builtin_is_my_dick_still_there())
5360 #define enable_adl(name) void name()noexcept=delete
5361
5362 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
5363 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
5364
5365 #define declvalue(...) (::std::declval<__VA_ARGS__>())
5366
5367 /*实例化到此将引发错误*/
5368 #define template_error(reason) static_assert(template_error_helper<T>,reason)
5369 /*实例化到此将引发警告*/
5370 #define template_warning(reason) template_warning_helper<T>(reason)
5371
5372 //for type_info
5373 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
5374 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
5375
5376 #define is_common_attribute(name) public attribute<T,name<T>>
5377 #define is_special_attribute(name) public attribute<T,name>
5378
5379 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
5380 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
5381
5382 //for float_size_t
5383 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
5384 //bitnum_of
5385 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
5386
5387 //for attribute
5388 #define def_common_attribute_with_nothing(name) \
5389 template<typename T>\
5390 class name{}\
5391
5392 #define def_special_attribute_with_nothing(name) \
5393 class name{}\
5394
5395 #define common_attribute_t template<class>class
5396 #define special_attribute_t class
5397
5398 /*
5399 若参数的布尔值为零,那么此模板不会实例化
5400
5401 为什么不用cpp20的constraints?
5402 1.不能类内定义
5403 2.不能作为模板参数
5404 一句话总结:c艹标准会sb
5405 */
5406 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
5407 /*默认参与模板候选*/
5408 #define enabled_by_default class enable_state=void
5409 /*默认不参与模板候选*/
5410 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
5411 /*若参数为病式,那么此模板不会实例化*/
5412 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
5413 /*用于模板声明*/
5414 #define enable_flag class enable_state
5415
5416 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
5417 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
5418 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
5419 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
5420 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
5421
5422 /*让lambda递归更加美观*/
5423 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
5424 /*让lambda递归更加美观*/
5425 #define get_recursive_lambda_caller(name) \
5426 lambda_with_catch(&)(auto&&...Args){\
5427 return name(name,Args...);\
5428 }
5429 /*让lambda定义更加美观*/
5430 #define lambda []
5431 /*让lambda定义更加美观*/
5432 #define lambda_with_catch(...) [__VA_ARGS__]
5433 /*让lambda递归更加美观*/
5434 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
5435 //recursive_lambda_self_referential_reserved_symbolname
5436 #define lambda_RLSRRS _my_jb_super_sb_name_
5437
5438 #define MAGIC//ahh,ko no tenno da!
5439
5440 /*装饰性语法糖*/
5441 #define nothing
5442
5443 /*aya风格语法糖*/
5444 #define elseif else if
5445 /*aya风格语法糖*/
5446 #define _big_than_ >
5447 /*aya风格语法糖*/
5448 #define _small_than_ <
5449
5450 #if defined(_MSC_VER)
5451 #define not !
5452 #define and &&
5453 #define or ||
5454 #endif
5455
5456 /*进入名称空间,并不是很美观*/
5457 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
5458 /*退出名称空间,并不是很美观*/
5459 #define BREAK_NAMESPACE }
5460
5461 /*template说明符*/
5462 #define template_name template
5463 /*template说明符*/
5464 #define type_name class
5465
5466 #if defined(DEBUG) || defined(_DEBUG)
5467 #define not_in_debug 0
5468 #else
5469 #define not_in_debug 1
5470 #endif
5471
5472 #define es U""
5473 #define ec(ch) U ## ch
5474
5475 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
5476 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
5477 #else
5478 #define ELC_TEST_EVENTNAME(name)
5479 #endif
5480
5481 #define override_instance_struct \
5482 protected:\
5483 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
5484 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
5485 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
5486 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
5487 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
5488
5489 #if defined(_WIN32)
5490 #define distinctive __declspec(dllexport)
5491 #else
5492 #define distinctive
5493 #endif
5494
5495 #if defined(_WIN32)
5496 #define force_inline __forceinline
5497 #elif defined(__GNUC__)
5498 #define force_inline __attribute__((always_inline)) inline
5499 #else
5500 #define force_inline inline
5501 #endif
5502
5503 #if defined(_WIN32)
5504 #define with_no_vtable __declspec(novtable)
5505 #else
5506 #define with_no_vtable
5507 #endif
5508
5509 #define in_consteval (::std::is_constant_evaluated())
5510
5511 #define no_vtable_struct struct with_no_vtable
5512 #define no_vtable_class class with_no_vtable
5513
5514 //file_end
5515
5516 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
5517
5518 //file_end
5519
5520 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
5521
5522 namespace memory{
5523 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
5524 //_body.hpp
5525 //at namespace elc::defs::memory
5526 /*
5527 未完成的elc解释器base文件
5528 由steve02081504与Alex0125设计、编写
5529 转载时请在不对此文件做任何修改的同时注明出处
5530 项目地址:https://github.com/steve02081504/ELC
5531 */
5532 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/defs.hpp"
5533 //defs.hpp
5534 //at namespace elc::defs::memory
5535 /*
5536 未完成的elc解释器base文件
5537 由steve02081504与Alex0125设计、编写
5538 转载时请在不对此文件做任何修改的同时注明出处
5539 项目地址:https://github.com/steve02081504/ELC
5540 */
5541 namespace lifetime_n{
5542 class copy_t;
5543
5544 class move_t;
5545 //
5546
5547 template<class T>
5548 class construct_t;
5549 template<class T,class...Args>
5550 constexpr bool construct_able=::std::is_constructible_v<T,Args...>;
5551 template<class T,class...Args>
5552 constexpr bool construct_nothrow=::std::is_nothrow_constructible_v<T,Args...>;
5553 template<class T,class...Args>
5554 constexpr bool construct_trivial=::std::is_trivially_constructible_v<T,Args...>;
5555
5556 class destruct_t;
5557 template<class T>
5558 constexpr bool destruct_able=::std::is_destructible_v<T>;
5559 template<class T>
5560 constexpr bool destruct_nothrow=::std::is_nothrow_destructible_v<T>;
5561 template<class T>
5562 constexpr bool destruct_trivial=::std::is_trivially_destructible_v<T>;
5563 //
5564
5565 class copy_construct_t;
5566 template<class T>
5567 constexpr bool copy_construct_able=::std::is_copy_constructible_v<T>;
5568 template<class T>
5569 constexpr bool copy_construct_nothrow=::std::is_nothrow_copy_constructible_v<T>;
5570 template<class T>
5571 constexpr bool copy_construct_trivial=::std::is_trivially_copy_constructible_v<T>;
5572
5573 class move_construct_t;
5574 template<class T>
5575 constexpr bool move_construct_able=::std::is_move_constructible_v<T>;
5576 template<class T>
5577 constexpr bool move_construct_nothrow=::std::is_nothrow_move_constructible_v<T>;
5578 template<class T>
5579 constexpr bool move_construct_trivial=::std::is_trivially_move_constructible_v<T>;
5580 //
5581
5582 class copy_assign_t;
5583 template<class T>
5584 constexpr bool copy_assign_able=::std::is_copy_assignable_v<T>;
5585 template<class T>
5586 constexpr bool copy_assign_nothrow=::std::is_nothrow_copy_assignable_v<T>;
5587 template<class T>
5588 constexpr bool copy_assign_trivial=::std::is_trivially_copy_assignable_v<T>;
5589
5590 class move_assign_t;
5591 template<class T>
5592 constexpr bool move_assign_able=::std::is_move_assignable_v<T>;
5593 template<class T>
5594 constexpr bool move_assign_nothrow=::std::is_nothrow_move_assignable_v<T>;
5595 template<class T>
5596 constexpr bool move_assign_trivial=::std::is_trivially_move_assignable_v<T>;
5597 //
5598
5599 template<class T> requires(::std::is_trivially_copyable_v<T>)
5600 force_inline T* super_speed_trivial_copy_from_one(T*to,const T&value,size_t size)noexcept{
5601 if constexpr(sizeof(T)==sizeof(unsigned char))
5602 ::std::memset((unsigned char*)to,(unsigned char)value,size);
5603 elseif constexpr(sizeof(T)==sizeof(wchar_t))
5604 ::std::wmemset((wchar_t*)to,(wchar_t)value,size);
5605 else
5606 if(is_all_byte_zero(value))
5607 ::std::memset(to,zero,size*sizeof(T));
5608 else
5609 ::std::fill_n(to,size,value);
5610 return to;
5611 }
5612 template<class T> requires(::std::is_trivially_copyable_v<T>)
5613 force_inline T* super_speed_trivial_copy_from_one(T*to,const T&value)noexcept{
5614 if constexpr(sizeof(T)>=sizeof(::std::max_align_t))
5615 if(is_all_byte_zero(value))
5616 ::std::memset(to,zero,sizeof(T));
5617 else
5618 *to=value;
5619 else
5620 *to=value;
5621 return to;
5622 }
5623
5624 /*
5625 lifetime_n的一部分
5626 所有的construct_t实例都派生于此
5627 */
5629 /*
5630 lifetime_n的一部分
5631 用于构造实例
5632 用法详见变量模板construct
5633 */
5634 template<typename T>
5637 template<class...Args>
5638 static constexpr bool able=construct_able<T,Args...>;
5639 template<class...Args>
5640 static constexpr bool nothrow=construct_nothrow<T,Args...>;
5641 template<class...Args>
5642 static constexpr bool trivial=construct_trivial<T,Args...>;
5643
5644 template<class...Args> requires able<Args...>
5645 [[nodiscard]]force_inline T operator()(Args&&...rest)const noexcept(nothrow<Args...>){
5646 return T(forward<Args>(rest)...);
5647 }
5650 size_t _size;
5651 constexpr void never_in_array_check()const noexcept{
5652 if constexpr(type_info<T>.has_attribute(never_in_array))
5653 template_error("You can\'t construct an array for never_in_array type.");
5654 }
5655 template<class...Args> requires able<Args...>
5656 force_inline void base_call(Args&&...rest)const noexcept(nothrow<Args...>){
5657 auto tmp=_size;
5658 while(tmp--)new(_to+tmp)T(forward<Args>(rest)...);
5659 }
5660 template<class...Args> requires able<Args...>
5661 force_inline T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
5662 never_in_array_check();
5663 base_call(forward<Args>(rest)...);
5664 return _to;
5665 }
5666 //复制构造速度优化
5667 force_inline T* operator()(const T&v)const noexcept(nothrow<const T&>)requires able<const T&>{
5668 never_in_array_check();
5669 if constexpr(trivial<const T&> && ::std::is_trivially_copyable_v<T>)
5671 else
5672 base_call(forward<const T&>(v));
5673 return _to;
5674 }
5675 //默认构造逻辑优化
5676 force_inline T* operator()()const noexcept(nothrow<>)requires able<>{
5677 never_in_array_check();
5678 if constexpr(!trivial<>)
5679 base_call();
5680 return _to;
5681 }
5682 };
5685 template<class...Args> requires able<Args...>
5686 force_inline void base_call(Args&&...rest)const noexcept(nothrow<Args...>){
5687 new(_to)T(forward<Args>(rest)...);
5688 }
5689 template<class...Args> requires able<Args...>
5690 force_inline T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
5691 base_call(forward<Args>(rest)...);
5692 return _to;
5693 }
5694 //复制构造速度优化
5695 force_inline T* operator()(const T&v)const noexcept(nothrow<const T&>)requires able<const T&>{
5696 if constexpr(trivial<const T&> && ::std::is_trivially_copyable_v<T>)
5698 else
5699 base_call(forward<const T&>(v));
5700 return _to;
5701 }
5702 //默认构造逻辑优化
5703 force_inline T* operator()()const noexcept(nothrow<>)requires able<>{
5704 if constexpr(!trivial<>)
5705 base_call();
5706 return _to;
5707 }
5708 [[nodiscard]]force_inline constexpr array_construct_t operator[](size_t size)const noexcept{return{_to,size};}
5709 };
5710 [[nodiscard]]force_inline constexpr placement_construct_t operator[](T*p)const noexcept{return{p};}
5711 };
5712 /*
5713 lifetime_n的一部分
5714 constexpr变量模板,用于构造实例
5715 用法:
5716 construct<类型>.able<构造参数类型> -> bool
5717 construct<类型>.nothrow<构造参数类型> -> bool
5718 construct<T>(参数) -> T (以参数构建T类型实例)
5719
5720 construct<T>[T*ptr](参数) -> T* (以参数在ptr地址处构建T类型实例,返回ptr)
5721 construct<T>[T*ptr][size_t size](参数) -> T* (以参数在ptr地址处构建size个T类型实例,返回ptr)
5722 */
5723 template<typename T>
5725
5726 /*
5727 lifetime_n的一部分
5728 用于销毁实例
5729 用法:
5730 destruct.able<类型> -> bool
5731 destruct.nothrow<类型> -> bool
5732
5733 destruct(T*ptr) -> void (在ptr地址处析构T类型实例,T可为数组)
5734 destruct[size_t size](T*ptr) -> void (析构以ptr地址起始共size个T类型实例,T可为数组)
5735 */
5736 constexpr struct destruct_t{
5737 template<class T>
5738 static constexpr bool able=destruct_able<T>||(::std::is_array_v<T>&&able<::std::remove_extent_t<T>>);
5739 template<class T>
5740 static constexpr bool nothrow=destruct_nothrow<T>||(::std::is_array_v<T>&&nothrow<::std::remove_extent_t<T>>);
5741 template<class T>
5742 static constexpr bool trivial=destruct_trivial<T>||(::std::is_array_v<T>&&trivial<::std::remove_extent_t<T>>);
5743
5744 template<class T> requires able<T>
5745 static force_inline void base_call(T*to)noexcept(nothrow<T>){
5746 if constexpr(!trivial<T>)
5747 if constexpr(::std::is_array_v<T>)
5748 for(auto&i : *to)
5749 base_call(addressof(i));
5750 else
5751 suppress_msvc_warning(26457)//虽然我不是很理解为啥调用析构函数会触发这个
5752 to->~T();
5753 }
5754
5755 template<class T> requires able<T>
5756 static void base_call([[maybe_unused]]T*begin,[[maybe_unused]]size_t size)noexcept(nothrow<T>){
5757 if constexpr(type_info<T>.has_attribute(never_in_array))
5758 template_error("You cannot perform array operations on never_in_array type.");
5759 if constexpr(!trivial<T>)
5760 while(size--)base_call(begin+size);
5761 }
5762
5763 template<class T> requires able<T>
5764 force_inline void operator()(T*begin)const noexcept(nothrow<T>){
5765 base_call(begin);
5766 }
5767
5769 size_t _size;
5770 template<class T> requires able<T>
5771 force_inline void operator()(T*begin)const noexcept(nothrow<T>){
5772 base_call(begin,_size);
5773 }
5774 };
5775
5776 [[nodiscard]]force_inline constexpr array_destruct_t operator[](size_t size)const noexcept{return{size};}
5777
5778 struct not_t{};
5779 /*适用于unget(this,not destruct);*/
5780 force_inline constexpr not_t operator!()const noexcept{return not_t{};}
5781 }destruct{};
5782
5783 /*
5784 lifetime_n的一部分
5785 用于重新构造实例:先摧毁,再原地构建
5786 用法:
5787 re_construct.able<类型> -> bool
5788 re_construct.nothrow<类型> -> bool
5789
5790 re_construct(T*ptr) -> T* (以无参数在ptr地址处重新构建T类型实例,返回ptr)
5791 re_construct[T*ptr](参数) -> T* (以参数在ptr地址处重新构建T类型实例,返回ptr)
5792 re_construct[T*ptr][size_t size](参数) -> T* (以参数在ptr地址处重新构建size个T类型实例,返回ptr)
5793 常见用法:
5794 re_construct(this)
5795 */
5796 constexpr struct re_construct_t{
5797 template<class T,class...Args>
5798 static constexpr bool able=destruct.able<T>&&construct<T>.able<Args...>;
5799 template<class T,class...Args>
5800 static constexpr bool nothrow=destruct.nothrow<T>&&construct<T>.nothrow<Args...>;
5801 template<class T,class...Args>
5802 static constexpr bool trivial=destruct.trivial<T>&&construct<T>.trivial<Args...>;
5803
5804 template<class T> requires able<T>
5805 force_inline T* operator()(T*to)const noexcept(nothrow<T>){
5806 destruct(to);
5807 construct<T>[to]();
5808 return to;
5809 }
5810 template<class T>
5813 size_t _size;
5814 template<class...Args> requires able<T,Args...>
5815 T* operator()(Args&&...rest)const noexcept(nothrow<T,Args...>){
5816 if constexpr(type_info<T>.has_attribute(never_in_array))
5817 template_error("You cannot perform array operations on never_in_array type.");
5818 destruct[_size](_to);
5819 construct<T>[_to][_size](forward<Args>(rest)...);
5820 return _to;
5821 }
5822 };
5823 template<class T>
5826 template<class...Args> requires able<T,Args...>
5827 T* operator()(Args&&...rest)const noexcept(nothrow<T,Args...>){
5828 destruct(_to);
5829 construct<T>[_to](forward<Args>(rest)...);
5830 return _to;
5831 }
5832 [[nodiscard]]force_inline constexpr array_re_construct_t<T> operator[](size_t size)const noexcept{return{_to,size};}
5833 };
5834 template<class T>
5835 [[nodiscard]]force_inline constexpr placement_re_construct_t<T> operator[](T*p)const noexcept{return{p};}
5836 }re_construct;
5837
5838 constexpr struct copy_construct_t{
5839 template<class T>
5840 static constexpr bool r_able=copy_construct_able<T>?
5841 copy_construct_trivial<T>||!(construct<T>.trivial<>&&copy_assign_trivial<T>)
5842 :false;//trivial操作优先考虑
5843 template<class T>
5844 static constexpr bool able=r_able<T>?true:(construct<T>.able<>&&copy_assign_able<T>);
5845 template<class T>
5846 static constexpr bool nothrow=r_able<T>?copy_construct_nothrow<T>:
5847 (construct<T>.nothrow<>&&copy_assign_nothrow<T>);
5848 template<class T>
5849 static constexpr bool trivial=r_able<T>?copy_construct_trivial<T>:
5850 (construct<T>.trivial<>&&copy_assign_trivial<T>);
5851
5852 template<class T> requires able<T>
5853 static T*base_call(T*to,const T*from)noexcept(nothrow<T>){
5854 if constexpr(trivial<T>)
5855 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)));
5856 else{
5857 if constexpr(r_able<T>)
5858 new(to)T(*from);
5859 else{
5860 construct<T>[to]();
5861 *to=*from;
5862 }
5863 return to;
5864 }
5865 }
5866
5867 template<class T> requires able<T>
5868 static T*base_call(T*to,const T*from,size_t size)noexcept(nothrow<T>){
5869 if constexpr(trivial<T>)
5870 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)*size));
5871 else{
5872 while(size--)
5873 base_call(to+size,from+size);
5874 return to;
5875 }
5876 }
5877
5878 template<class T> requires able<T>
5879 force_inline T*operator()(T*to,const T*from)const noexcept(nothrow<T>)
5880 {return base_call(to,from);}
5881
5882 template<class T> requires able<T>
5884 {return base_call(to(),from());}
5885
5886 template<class T> requires able<T>
5888 {return base_call(to(),from());}
5889
5890
5891 template<class T> requires able<T>
5892 force_inline T*operator()(T*to,const T*from,size_t size)const noexcept(nothrow<T>)
5893 {return base_call(to,from,size);}
5894
5895 template<class T> requires able<T>
5896 force_inline T*operator()(note::to_t<T*>to,note::from_t<const T*>from,size_t size)const noexcept(nothrow<T>)
5897 {return base_call(to(),from(),size);}
5898
5899 template<class T> requires able<T>
5900 force_inline T*operator()(note::from_t<const T*>from,note::to_t<T*>to,size_t size)const noexcept(nothrow<T>)
5901 {return base_call(to(),from(),size);}
5902
5903 template<class T> requires able<T>
5904 static T*base_call(T*to,const T&from)noexcept(nothrow<T>){
5905 if constexpr(r_able<T>)
5906 construct<T>[to](from);
5907 else{
5908 construct<T>[to]();
5909 *to=from;
5910 }
5911 return to;
5912 }
5913
5914 template<class T> requires able<T>
5915 static T*base_call(T*to,const T&from,size_t size)noexcept(nothrow<T>){
5916 if constexpr(type_info<T>.has_attribute(never_in_array))
5917 template_error("You cannot perform array operations on never_in_array type.");
5918 if constexpr(::std::is_trivially_copyable_v<T>)
5920 else
5921 while(size--)
5922 base_call(to+size,from);
5923 return to;
5924 }
5925
5926 template<class T> requires able<T>
5927 force_inline T*operator()(T*to,const T&from)const noexcept(nothrow<T>)
5928 {return base_call(to,from);}
5929
5931 size_t _size;
5932 template<class T> requires able<T>
5933 force_inline T*operator()(T*to,const T*from)const noexcept(nothrow<T>){
5934 return base_call(to,from,_size);
5935 }
5936 template<class T> requires able<T>
5937 force_inline T*operator()(T*to,const T&from)const noexcept(nothrow<T>){
5938 return base_call(to,from,_size);
5939 }
5940 template<class T> requires able<T>
5942 return operator()(to(),from());
5943 }
5944 template<class T> requires able<T>
5946 return operator()(to(),from());
5947 }
5948 };
5949 [[nodiscard]]force_inline constexpr array_copy_construct_t operator[](size_t a)const noexcept{return{a};}
5950 }copy_construct{};
5951
5952 constexpr struct move_construct_t{
5953 template<class T>
5954 static constexpr bool r_able=move_construct_able<T>?
5955 move_construct_trivial<T>||!copy_construct.trivial<T>
5956 :false;//trivial操作优先考虑
5957 template<class T>
5958 static constexpr bool able=r_able<T>?true:copy_construct.able<T>;
5959 template<class T>
5960 static constexpr bool nothrow=r_able<T>?move_construct_nothrow<T>:
5962 template<class T>
5963 static constexpr bool trivial=r_able<T>?move_construct_trivial<T>:
5965
5966 template<class T> requires able<T>
5967 static T*base_call(T*to,T*from)noexcept(nothrow<T>){
5968 if constexpr(trivial<T>)
5969 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)));
5970 else{
5971 if constexpr(r_able<T>){
5972 construct<T>[to](::std::move(*from));
5973 return to;
5974 }else
5975 return copy_construct(to,from);
5976 }
5977 }
5978 template<class T> requires able<T>
5979 static T*base_call(T*to,T*from,size_t size)noexcept(nothrow<T>){
5980 if constexpr(type_info<T>.has_attribute(never_in_array))
5981 template_error("You cannot perform array operations on never_in_array type.");
5982 if constexpr(trivial<T>)
5983 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)*size));
5984 else{
5985 if constexpr(r_able<T>){
5986 while(size--)
5987 construct<T>[to+size](::std::move(from[size]));
5988 return to;
5989 }else
5990 return copy_construct[size](to,from);
5991 }
5992 }
5993
5994 template<class T> requires able<T>
5995 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>)
5996 {return base_call(to,from);}
5997
5998 template<class T> requires able<T>
5999 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>)
6000 {return base_call(to(),from());}
6001
6002 template<class T> requires able<T>
6003 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>)
6004 {return base_call(to(),from());}
6005
6007 size_t _size;
6008 template<class T> requires able<T>
6009 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>){
6010 return base_call(to,from,_size);
6011 }
6012 template<class T> requires able<T>
6013 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>){
6014 return operator()(to(),from());
6015 }
6016 template<class T> requires able<T>
6017 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6018 return operator()(to(),from());
6019 }
6020 };
6021 [[nodiscard]]force_inline constexpr array_move_construct_t operator[](size_t a)const noexcept{return{a};}
6022 }move_construct{};
6023
6024 constexpr struct move_t{
6025 template<class T>
6026 static constexpr bool able=move_construct.able<T>&&destruct.able<T>;
6027 template<class T>
6028 static constexpr bool nothrow=move_construct.nothrow<T>&&destruct.nothrow<T>;
6029 template<class T>
6030 static constexpr bool trivial=move_construct.trivial<T>&&destruct.trivial<T>;
6031
6032 template<class T> requires able<T>
6033 static T*base_call(T*to,T*from)noexcept(nothrow<T>){
6034 move_construct(to,from);
6035 destruct(from);
6036 return to;
6037 }
6038 template<class T> requires able<T>
6039 static T*base_call(T*to,T*from,size_t size)noexcept(nothrow<T>){
6040 if constexpr(type_info<T>.has_attribute(never_in_array))
6041 template_error("You cannot perform array operations on never_in_array type.");
6042 move_construct[size](to,from);
6043 destruct[size](from);
6044 return to;
6045 }
6046
6047 template<class T> requires able<T>
6048 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>)
6049 {return base_call(to,from);}
6050
6051 template<class T> requires able<T>
6052 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>)
6053 {return base_call(to(),from());}
6054
6055 template<class T> requires able<T>
6056 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>)
6057 {return base_call(to(),from());}
6058
6060 size_t _size;
6061 template<class T> requires able<T>
6062 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>){
6063 return base_call(to,from,_size);
6064 }
6065 template<class T> requires able<T>
6066 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>){
6067 return operator()(to(),from());
6068 }
6069 template<class T> requires able<T>
6070 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6071 return operator()(to(),from());
6072 }
6073 };
6074 [[nodiscard]]force_inline constexpr array_move_t operator[](size_t a)const noexcept{return{a};}
6075
6076 //特殊使用
6077 template<class T>
6078 [[nodiscard]]constexpr remove_ref<T>&& operator()(T&&a)const noexcept{
6079 return static_cast<remove_ref<T>&&>(a);
6080 }
6081 }move{};
6082
6083 constexpr struct copy_t{
6084 //特殊使用
6085 //UF
6086 template<class T> requires(copy_construct.able<T>)
6087 [[nodiscard]]constexpr T operator()(const T&a)const noexcept{
6088 return copy_construct<T>(a);
6089 }
6090 }copy{};
6091
6092 constexpr struct copy_assign_t{
6093 template<class T>
6094 static constexpr bool r_able=copy_assign_able<T>?
6095 copy_assign_trivial<T>||!(copy_construct_trivial<T>&&destruct.trivial<T>)
6096 :false;//trivial操作优先考虑
6097 template<class T>
6098 static constexpr bool able=r_able<T>?true:(copy_construct_able<T>&&destruct.able<T>);
6099 template<class T>
6100 static constexpr bool nothrow=r_able<T>?copy_assign_nothrow<T>:
6101 (copy_construct_nothrow<T>&&destruct.nothrow<T>);
6102 template<class T>
6103 static constexpr bool trivial=r_able<T>?copy_assign_trivial<T>:
6104 (copy_construct_trivial<T>&&destruct.trivial<T>);
6105
6106 template<class T> requires able<T>
6107 static T& base_call(T&a,const T&b)noexcept(nothrow<T>){
6108 if constexpr(r_able<T>)
6109 a=b;
6110 else{
6111 destruct(&a);
6112 construct<T>[&a](b);
6113 }
6114 return a;
6115 }
6116 template<class T> requires able<T>
6117 static T* base_call(T*to,const T*from,size_t size)noexcept(nothrow<T>){
6118 if constexpr(trivial<T>)
6119 ::std::memcpy(to,add_const(from),size*sizeof(T));
6120 else{
6121 while(size--)
6122 base_call(to[size],from[size]);
6123 }
6124 return to;
6125 }
6126 template<class T> requires able<T>
6127 static T* base_call(T* to,const T& from,size_t size)noexcept(nothrow<T>){
6128 if constexpr(trivial<T>)
6130 else
6131 while(size--)
6132 base_call(to[size],from);
6133 return to;
6134 }
6135
6136 template<class T> requires able<T>
6137 force_inline T& operator()(T&a,const T&b)const noexcept(nothrow<T>){
6138 return base_call(a,b);
6139 }
6140
6142 size_t _size;
6143 template<class T> requires able<T>
6144 force_inline T*operator()(T*to,const T*from)const noexcept(nothrow<T>){
6145 return base_call(to,from,_size);
6146 }
6147 template<class T> requires able<T>
6149 return operator()(to(),from());
6150 }
6151 template<class T> requires able<T>
6153 return operator()(to(),from());
6154 }
6155 template<class T> requires able<T>
6156 force_inline T*operator()(const T&from,note::to_t<T*>to)const noexcept(nothrow<T>){
6157 return base_call(to(),from,_size);
6158 }
6159 template<class T> requires able<T>
6160 force_inline T*operator()(note::to_t<T*>to,const T&from)const noexcept(nothrow<T>){
6161 return base_call(to(),from,_size);
6162 }
6163 };
6164 [[nodiscard]]force_inline constexpr array_copy_assign_t operator[](size_t a)const noexcept{return{a};}
6165 }copy_assign{};
6166
6167 constexpr struct move_assign_t{
6168 template<class T>
6169 static constexpr bool r_able=move_assign_able<T>;
6170 template<class T>
6171 static constexpr bool able=r_able<T>?true:copy_assign.able<T>;
6172 template<class T>
6173 static constexpr bool nothrow=r_able<T>?move_assign_nothrow<T>:copy_assign.nothrow<T>;
6174 template<class T>
6175 static constexpr bool trivial=r_able<T>?move_assign_trivial<T>:copy_assign.trivial<T>;
6176
6177 template<class T> requires able<T>
6178 static T& base_call(T&a,T&&b)noexcept(nothrow<T>){
6179 if constexpr(r_able<T>)
6180 a=move(b);
6181 else{
6182 copy_assign(a,b);
6183 }
6184 return a;
6185 }
6186 template<class T> requires able<T>
6187 static T* base_call(T*to,T*from,size_t size)noexcept(nothrow<T>){
6188 if constexpr(trivial<T>)
6189 ::std::memcpy(to,add_const(from),size*sizeof(T));
6190 else{
6191 while(size--)
6192 base_call(to[size],from[size]);
6193 }
6194 return to;
6195 }
6196
6197 template<class T> requires able<T>
6198 force_inline T& operator()(T&a,T&b)const noexcept(nothrow<T>){
6199 return base_call(a,move(b));
6200 }
6201
6203 size_t _size;
6204 template<class T> requires able<T>
6205 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>){
6206 return base_call(to,from,_size);
6207 }
6208 template<class T> requires able<T>
6209 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>){
6210 return operator()(to(),from());
6211 }
6212 template<class T> requires able<T>
6213 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6214 return operator()(to(),from());
6215 }
6216 };
6217 [[nodiscard]]force_inline constexpr array_move_assign_t operator[](size_t a)const noexcept{return{a};}
6218 }move_assign{};
6219 }
6220
6221 //file_end
6222
6223 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
6224 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_export.hpp"
6225 //_export.hpp
6226 //at namespace elc::defs::memory
6227 /*
6228 未完成的elc解释器base文件
6229 由steve02081504与Alex0125设计、编写
6230 转载时请在不对此文件做任何修改的同时注明出处
6231 项目地址:https://github.com/steve02081504/ELC
6232 */
6233 #define export using lifetime_n::
6234 export construct;
6235 export destruct;
6236 export re_construct;
6237 export copy_assign;
6238 export move_assign;
6239 export move;
6240 export copy;
6241 export copy_construct;
6242 export move_construct;
6243 #undef export
6244
6245 //file_end
6246
6247 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
6248 #if defined(ELC_TEST_ON)
6249 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_test.hpp"
6250 //_test.hpp
6251 //at namespace elc::defs::memory
6252 /*
6253 未完成的elc解释器base文件
6254 由steve02081504与Alex0125设计、编写
6255 转载时请在不对此文件做任何修改的同时注明出处
6256 项目地址:https://github.com/steve02081504/ELC
6257 */
6258 namespace lifetime_n{
6259 //BLOCK:for debug
6260 inline void test(){
6261 ELC_TEST_EVENTNAME("lifetime部分测试");
6262 }
6263 inline void test_log_out(){
6264 }
6265 inline void test_end(){
6266 }
6267 //BLOCK_END
6268 }
6269
6270 //file_end
6271
6272 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
6273 #endif
6274
6275 //file_end
6276
6277 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
6278 }
6279 namespace base{
6280 //依赖lifetime
6281 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6282 //_body.hpp
6283 //at namespace elc::defs::base
6284 /*
6285 未完成的elc解释器base文件
6286 由steve02081504与Alex0125设计、编写
6287 转载时请在不对此文件做任何修改的同时注明出处
6288 项目地址:https://github.com/steve02081504/ELC
6289 */
6290 //D?
6291 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/flag.hpp"
6292 //flag.hpp
6293 //at namespace elc::defs::base
6294 /*
6295 未完成的elc解释器base文件
6296 由steve02081504与Alex0125设计、编写
6297 转载时请在不对此文件做任何修改的同时注明出处
6298 项目地址:https://github.com/steve02081504/ELC
6299 */
6300 /*
6301 表示flag是否被设置的enum字面量.
6302 */
6303 enum flag_set_type:bool{seted=true,not_set=false};
6304 /*
6305 bool的简易包装以表示『是否被设置』,无法使用operator=,因为不应如此.
6306 */
6307 class flag{
6308 bool _m;
6309 public:
6310 constexpr explicit flag(flag_set_type a=not_set)noexcept:_m(bool(a)){}
6311 [[nodiscard]]explicit operator bool()const noexcept{return _m;}
6312 flag(flag&a)noexcept:_m((bool)a){}
6313 flag(flag&&a)noexcept:_m((bool)a){}
6314 inline void operator=(flag&)&noexcept=delete;
6315 inline void operator=(flag&&)&noexcept=delete;
6316 inline void set()noexcept{_m=true;}
6317 inline void unset()noexcept{_m=false;}
6318 };
6319
6320 //file_end
6321
6322 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6323 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/mark_type.hpp"
6324 //mark_type.hpp
6325 //at namespace elc::defs::base
6326 /*
6327 未完成的elc解释器base文件
6328 由steve02081504与Alex0125设计、编写
6329 转载时请在不对此文件做任何修改的同时注明出处
6330 项目地址:https://github.com/steve02081504/ELC
6331 */
6332 /*
6333 表明是否被标记的enum字面量.
6334 */
6335 enum mark_type:bool{marked=true,not_mark=false};
6336 /*
6337 用于gc的可达性分析的普通模板式elc属性.
6338 */
6339 template<typename T>
6341 mutable flag _m;
6342 public:
6343 constexpr explicit mark_able(mark_type a=not_mark)noexcept:_m(a==not_mark?not_set:seted){};
6344 inline void mark()const noexcept{_m.set();}
6345 inline void unmark()const noexcept{_m.unset();}
6346 [[nodiscard]]bool was_marked()const noexcept{return(bool)_m;}
6347 };
6348
6349 //file_end
6350
6351 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6352
6353 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/iterator.hpp"
6354 //iterator.hpp
6355 //at namespace elc::defs::base
6356 /*
6357 未完成的elc解释器base文件
6358 由steve02081504与Alex0125设计、编写
6359 转载时请在不对此文件做任何修改的同时注明出处
6360 项目地址:https://github.com/steve02081504/ELC
6361 */
6362 namespace iterator_n{
6363 using namespace memory;//copy_assign、move_assign
6364 template<typename base_t_w>
6369 template<typename build_base_t_T> requires(construct<base_t_rw>.able<build_base_t_T>)
6370 constexpr reverse_base_t(build_base_t_T&& a)noexcept(construct<base_t_rw>.nothrow<build_base_t_T>):_m(a){}
6371 [[nodiscard]]auto get_before()noexcept_as(declvalue(base_t_w).get_next()){ return ((base_t_w&)_m).get_next(); }
6372 [[nodiscard]]auto get_next()noexcept_as(declvalue(base_t_w).get_before()){ return ((base_t_w&)_m).get_before(); }
6373 [[nodiscard]]auto get_handle()noexcept_as(declvalue(base_t_w).get_handle()){ return ((base_t_w&)_m).get_handle(); }
6374 };
6375 template<typename base_t> requires(compare.able<base_t>)
6376 [[nodiscard]]auto operator<=>(const reverse_base_t<base_t>&a,const reverse_base_t<base_t>&b)noexcept(compare.nothrow<base_t>){
6377 return compare((const base_t&)b._m,(const base_t&)a._m);
6378 }
6379 template<typename base_t,typename T> requires(compare.able<T,base_t> && type_info<remove_cvref<T>> != type_info<reverse_base_t<base_t>::base_t_rw>)
6380 [[nodiscard]]auto operator<=>(const reverse_base_t<base_t>& a,T&& b)noexcept(compare.nothrow<T,base_t>){
6381 return compare(b,(const base_t&)a._m);
6382 }
6383 template<typename base_t,typename T> requires(compare.able<base_t,T> && type_info<remove_cvref<T>> != type_info<reverse_base_t<base_t>::base_t_rw>)
6384 [[nodiscard]]auto operator<=>(T&& a,const reverse_base_t<base_t>& b)noexcept(compare.nothrow<base_t,T>){
6385 return compare((const base_t&)b._m,a);
6386 }
6387 template<typename base_t,typename T> requires(equal.able<T,base_t>)
6388 [[nodiscard]]auto operator==(const reverse_base_t<base_t>& a,T&& b)noexcept(equal.nothrow<T,base_t>){
6389 return equal(b,(const base_t&)a._m);
6390 }
6391 template<typename base_t,typename T> requires(equal.able<base_t,T>)
6392 [[nodiscard]]auto operator==(T&& a,const reverse_base_t<base_t>& b)noexcept(equal.nothrow<base_t,T>){
6393 return equal((const base_t&)b._m,a);
6394 }
6395
6396 template<typename value_t,typename base_t_w>
6398 template<typename,typename>
6399 friend class same_base_t;
6400 protected:
6403 //
6404 mutable base_t_rw _m;
6405 //
6406 [[nodiscard]]static constexpr bool is_handle_getter_noexcept()noexcept{
6407 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6408 return true;
6409 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_handle()))
6410 return noexcept(declvalue(base_t_w)->get_handle());
6411 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_handle()))
6412 return noexcept(declvalue(base_t_w).get_handle());
6413 }
6414 [[nodiscard]]inline value_t*handle_getter()const noexcept(is_handle_getter_noexcept()){
6415 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6416 return ((base_t_w)_m);
6417 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_handle()))
6418 return ((base_t_w)_m)->get_handle();
6419 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_handle()))
6420 return ((base_t_w)_m).get_handle();
6421 }
6422 //
6423 [[nodiscard]]static constexpr bool is_value_getter_noexcept()noexcept{
6424 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6425 return true;
6426 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_value()))
6427 return noexcept(declvalue(base_t_w)->get_value());
6428 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_value()))
6429 return noexcept(declvalue(base_t_w).get_value());
6430 }
6431
6432 [[nodiscard]]static constexpr auto value_type_getter(){
6433 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6434 return type_info<decltype(*((base_t_w)_m))>;
6435 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_value()))
6436 return type_info<decltype(((base_t_w)_m)->get_value())>;
6437 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_value()))
6438 return type_info<decltype(((base_t_w)_m).get_value())>;
6439 else
6440 return type_info<decltype(*declvalue(value_t*))>;
6441 }
6442 typedef decltype(value_type_getter())::template_name type value_type;
6443
6444 [[nodiscard]]inline value_type value_getter()const noexcept(is_handle_getter_noexcept()){
6445 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6446 return *((base_t_w)_m);
6447 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_value()))
6448 return ((base_t_w)_m)->get_value();
6449 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_value()))
6450 return ((base_t_w)_m).get_value();
6451 else
6452 return *handle_getter();
6453 }
6454 //
6455 [[nodiscard]]static constexpr bool is_next_getter_noexcept()noexcept{
6456 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6457 return true;
6458 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_next()))
6459 return noexcept(declvalue(base_t_w)->get_next());
6460 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_next()))
6461 return noexcept(declvalue(base_t_w).get_next());
6462 }
6463 [[nodiscard]]inline base_t_w next_getter()const noexcept(is_next_getter_noexcept()){
6464 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6465 return ((base_t_w)_m)+1;
6466 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_next()))
6467 return ((base_t_w)_m)->get_next();
6468 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_next()))
6469 return ((base_t_w)_m).get_next();
6470 }
6471 //
6472 [[nodiscard]]static constexpr bool is_before_getter_noexcept()noexcept{
6473 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6474 return true;
6475 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_before()))
6476 return noexcept(declvalue(base_t_w)->get_before());
6477 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_before()))
6478 return noexcept(declvalue(base_t_w).get_before());
6479 }
6480 [[nodiscard]]inline base_t_w before_getter()const noexcept(is_before_getter_noexcept()){
6481 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6482 return ((base_t_w)_m)-1;
6483 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_before()))
6484 return ((base_t_w)_m)->get_before();
6485 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_before()))
6486 return ((base_t_w)_m).get_before();
6487 }
6488 public:
6490 //
6491 constexpr same_base_t()noexcept=default;
6492 template<typename build_base_t_T> requires(construct<base_t_rw>.able<build_base_t_T>)
6493 constexpr same_base_t(build_base_t_T&&a)noexcept(construct<base_t_rw>.nothrow<build_base_t_T>):_m(a){}
6494 constexpr same_base_t(const this_t&a)noexcept(construct<base_t_rw>.nothrow<const base_t_rw>):_m(a._m){}
6495 constexpr same_base_t(this_t&&a)noexcept_as(declvalue(this_t).swap_with(a)){swap_with(a);}
6496 template<typename other_T,typename other_base_t> requires(construct<base_t_rw>.able<other_base_t>)
6497 constexpr same_base_t(const same_base_t<other_T,other_base_t>&a)noexcept(construct<base_t_rw>.nothrow<other_base_t>):_m(a._m){}
6498 ~same_base_t()noexcept(destruct.nothrow<base_t_rw>)=default;
6499 [[nodiscard]]constexpr bool operator==(const this_t& a)const noexcept_as(declvalue(base_t_rw) == declvalue(base_t_rw)){ return _m == a._m; }
6500 [[nodiscard]]constexpr value_t* operator->()noexcept(is_handle_getter_noexcept()){ return handle_getter(); }
6501 [[nodiscard]]constexpr value_type operator*()noexcept_as(is_value_getter_noexcept()){ return value_getter(); }
6502 [[nodiscard]]constexpr operator value_t*()noexcept_as(declvalue(this_t).operator->()){ return operator->(); }
6503 [[nodiscard]]constexpr bool operator==(value_t* a)const noexcept(is_handle_getter_noexcept()&&noexcept(pointer_equal(declvalue(value_t*),declvalue(value_t*)))){ return pointer_equal(handle_getter(),a); }
6504 template<typename other_value_t,typename other_base_t_w> requires(equal.able<base_t_rw,other_base_t_w>)
6505 [[nodiscard]]constexpr bool operator==(const same_base_t<other_value_t,other_base_t_w>& a)const noexcept(equal.nothrow<base_t_rw,other_base_t_w>){
6506 return equal(_m,a._m);
6507 }
6508 template<typename other_value_t,typename other_base_t_w>
6509 [[nodiscard]]constexpr auto operator<=>(const same_base_t<other_value_t,other_base_t_w>& a)const noexcept(compare.nothrow<base_t_rw,other_base_t_w>){
6510 if constexpr(compare.able<base_t_rw,other_base_t_w>)
6511 return compare(_m,a._m);
6512 }
6513 };
6514 template<typename value_t,typename base_t_w>
6516 {a.swap_with(b);}
6517
6518 template<typename value_t,typename base_t_w>
6519 struct base_iterator_t:same_base_t<value_t,base_t_w>{
6522 protected:
6523 using base_t::is_before_getter_noexcept;
6524 using base_t::is_next_getter_noexcept;
6525 using base_t::before_getter;
6526 using base_t::next_getter;
6528 public:
6529 using base_t::base_t;
6530 constexpr this_t&operator=(const base_t_rw&a)&noexcept(copy_assign.nothrow<base_t_rw>){copy_assign(base_t::_m,a);return*this;}
6531 constexpr this_t&operator=(base_t_rw&&a)&noexcept(move_assign.nothrow<base_t_rw>){move_assign(base_t::_m,a);return*this;}
6532 constexpr this_t&operator++()&noexcept(is_next_getter_noexcept()){return*this=next_getter();}
6533 constexpr this_t&operator--()&noexcept(is_before_getter_noexcept()){return*this=before_getter();}
6534 constexpr this_t operator++(int)&noexcept_as(this_t(++declvalue(this_t&))){auto a=*this;operator++();return a;}
6535 constexpr this_t operator--(int)&noexcept_as(this_t(--declvalue(this_t&))){auto a=*this;operator--();return a;}
6536 constexpr this_t operator+(ptrdiff_t num)const noexcept_as(this_t(--declvalue(this_t&)),++declvalue(this_t&)){
6537 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6538 return base_t::_m+num;
6539 else{
6540 auto a=*this;
6541 if(num>0)
6542 while(num--)
6543 ++a;
6544 else
6545 while(num++)
6546 --a;
6547 return a;
6548 }
6549 }
6550 constexpr this_t operator-(ptrdiff_t num)const noexcept_as(declvalue(this_t&)+0){ return *this+(-num); }
6551 };
6552 template<typename value_t,typename base_t_w>
6554 template<typename value_t,typename base_t_w>
6556
6557 template<typename value_t,typename base_t_w=value_t*>
6559 template<typename value_t,typename base_t_w=const value_t*>
6561 template<typename value_t,typename base_t_w=value_t*>
6563 template<typename value_t,typename base_t_w=const value_t*>
6565 }
6571
6572 //file_end
6573
6574 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6575 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/list.hpp"
6576 //list.hpp
6577 //at namespace elc::defs::base
6578 /*
6579 未完成的elc解释器base文件
6580 由steve02081504与Alex0125设计、编写
6581 转载时请在不对此文件做任何修改的同时注明出处
6582 项目地址:https://github.com/steve02081504/ELC
6583 */
6584 //copy from old ELC
6585 template<typename T>
6586 class list_t;
6587 /*
6588 common attribute,表明这是对于list_t可加入的cons.
6589 */
6590 template<typename T>
6593 private:
6594 friend list_t<T>;
6595 friend iterator_t<T,this_t*>::base_t;
6597
6598 mutable this_t*_before;//为了在析构时修改前一项的next,勿删
6599 mutable this_t*_next;
6600
6601 [[nodiscard]]this_t*get_before()noexcept{return _before;}
6602 [[nodiscard]]this_t*get_next()noexcept{return _next;}
6603
6604 constexpr cons_t(this_t*a,this_t*b):_before(a),_next(b){}
6605
6606 constexpr void set_before(this_t*a){
6607 _before=a;
6608 a->_next=this;
6609 }
6610 constexpr void set_next(this_t*a){
6611 _next=a;
6612 a->_before=this;
6613 }
6614 constexpr void insert_to_before(this_t*a){
6615 set_before(a->_before);
6616 set_next(a);
6617 }
6618 constexpr void bind_with(this_t*a)noexcept{
6619 set_next(a);
6620 set_before(a);
6621 }
6622 constexpr void remove_from_list()noexcept{
6623 _before->set_next(_next);
6624 }
6625 [[nodiscard]]constexpr T*get_handle(){
6626 return attribute_t::get_handle();
6627 }
6628 public:
6629 constexpr cons_t()=default;
6631 remove_from_list();
6632 }
6633 };
6634 /*
6635 T类型的有序双向list.
6636 方法有:
6637 constexpr void add(cons_t<T>*a)noexcept;
6638 constexpr iterator begin()noexcept;
6639 constexpr iterator end()noexcept;
6640 constexpr iterator head()noexcept;
6641 constexpr bool empty()const noexcept;
6642 */
6643 template<typename T>
6644 struct list_t{
6647 typedef iterator_t<T,cons*>iterator;
6648 private:
6649 cons _begin,_end;
6650 public:
6651 constexpr list_t()noexcept{_begin.bind_with(&_end);}
6652 inline constexpr void add(cons*a)noexcept{
6653 a->insert_to_before(&_end);
6654 }
6655 [[nodiscard]]constexpr iterator begin()noexcept{return _begin.get_next();}//这叫头迭代器
6656 [[nodiscard]]constexpr iterator end()noexcept{return&_end;}//这叫超尾迭代器
6657 [[nodiscard]]constexpr iterator head()noexcept{return&_begin;}//。。。。这个大概就是超头迭代器了😂
6658 [[nodiscard]]constexpr bool empty()const noexcept{return _begin.get_next()==&_end;}
6659 };
6660
6661 //file_end
6662
6663 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6664
6665 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/function_base.hpp"
6666 //function_base.hpp
6667 //at namespace elc::defs::container
6668 /*
6669 未完成的elc解释器base文件
6670 由steve02081504与Alex0125设计、编写
6671 转载时请在不对此文件做任何修改的同时注明出处
6672 项目地址:https://github.com/steve02081504/ELC
6673 */
6674 namespace function_base_n{
6675 #if !defined(_MSC_VER)
6676 template<typename>
6678
6679 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6680 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)noexcept(nothrow)>
6681 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6682
6683 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6684 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)&noexcept(nothrow)>
6685 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6686
6687 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6688 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const noexcept(nothrow)>
6689 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6690
6691 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6692 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const&noexcept(nothrow)>
6693 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6694
6695 template<typename T>
6696 [[nodiscard]]constexpr auto function_type_getter_conditional_helper(){
6697 if constexpr(::std::is_function_v<T>)
6698 return type_info<T>;
6699 elseif constexpr(is_pointer<T> && ::std::is_function_v<::std::remove_pointer_t<T>>)//不支持多级函数指针:懒得写(其实挺简单的),而且function_t若支持多级函数指针的推导指引会很不安全
6700 return function_type_getter_conditional_helper<::std::remove_pointer_t<T>>();
6701 else
6702 return type_info<type_name function_type_getter_helper<decltype(&T::operator())>::type>;
6703 }
6704 template<typename T>
6706 typedef decltype(function_type_getter_conditional_helper<T>())::template_name type type;
6707 };
6708
6709 /*
6710 获取一个callable类型的“函数类型”
6711 如T(int)返回char,其函数类型便是char(int)
6712 */
6713 template<typename T>
6715
6716 /*
6717 用处:容纳一个callable类型(除过函数类型,但可以是其指针)并提供operator()
6718 小包装工具,能在意想不到的地方发挥效果(比如要额外携带数据的callable类型定义!见"../../lib_loader/lib_loader.hpp")
6719 */
6720 template<class T,class Func_t=get_function_type<T>>
6722 template<class T,bool nothrow,class Ret_t,class...Args_t>
6723 struct function_data_warpper_t<T,Ret_t(Args_t...)noexcept(nothrow)>{
6724 static_assert(!::std::is_function_v<T>);
6725
6727
6728 function_data_warpper_t(T a)noexcept(construct<T>.nothrow<T>):_value(a){}
6729 ~function_data_warpper_t()noexcept(destruct.nothrow<T>)=default;
6730 Ret_t operator()(Args_t...args)noexcept(nothrow || invoke<T>.nothrow<Args_t...>){
6731 //BLOCK:constexpr checks
6732 if constexpr(!invoke<T>.able<Args_t...>)
6733 template_error("this T can\'t becall as args.");
6734 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6735 template_error("the return type of T was wrong.");
6736 //BLOCK_END
6737 if constexpr(type_info<Ret_t> != type_info<void>)
6738 return _value(forward<Args_t>(args)...);
6739 else
6740 _value(forward<Args_t>(args)...);
6741 }
6742 Ret_t operator()(Args_t...args)const noexcept(nothrow || invoke<const T>.nothrow<Args_t...>) requires(invoke<const T>.able<Args_t...>){
6743 //BLOCK:constexpr checks
6744 if constexpr(!invoke<T>.able<Args_t...>)
6745 template_error("this T can\'t becall as args.");
6746 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6747 template_error("the return type of T was wrong.");
6748 //BLOCK_END
6749 if constexpr(type_info<Ret_t> != type_info<void>)
6750 return _value(forward<Args_t>(args)...);
6751 else
6752 _value(forward<Args_t>(args)...);
6753 }
6754 [[nodiscard]]auto&get_data()noexcept{return _value;}
6755 };
6756 #else
6757 //MSVC,我滴垃圾堆
6758 template<typename>
6759 struct function_type_getter_helper{};
6760
6761 template<typename Ret_t,typename T,typename...Args_t>
6762 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)>
6763 {using type=Ret_t(Args_t...);};
6764
6765 template<typename Ret_t,typename T,typename...Args_t>
6766 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)&>
6767 {using type=Ret_t(Args_t...);};
6768
6769 template<typename Ret_t,typename T,typename...Args_t>
6770 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const>
6771 {using type=Ret_t(Args_t...);};
6772
6773 template<typename Ret_t,typename T,typename...Args_t>
6774 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const&>
6775 {using type=Ret_t(Args_t...);};
6776
6777 template<typename Ret_t,typename T,typename...Args_t>
6778 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)noexcept>
6779 {using type=Ret_t(Args_t...)noexcept;};
6780
6781 template<typename Ret_t,typename T,typename...Args_t>
6782 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)&noexcept>
6783 {using type=Ret_t(Args_t...)noexcept;};
6784
6785 template<typename Ret_t,typename T,typename...Args_t>
6786 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const noexcept>
6787 {using type=Ret_t(Args_t...)noexcept;};
6788
6789 template<typename Ret_t,typename T,typename...Args_t>
6790 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const&noexcept>
6791 {using type=Ret_t(Args_t...)noexcept;};
6792
6793 template<typename T>
6794 [[nodiscard]]constexpr auto function_type_getter_conditional_helper(){
6795 if constexpr(::std::is_function_v<T>)
6796 return type_info<T>;
6797 elseif constexpr(is_pointer<T> && ::std::is_function_v<::std::remove_pointer_t<T>>)//不支持多级函数指针:懒得写(其实挺简单的),而且function_t若支持多级函数指针的推导指引会很不安全
6798 return function_type_getter_conditional_helper<::std::remove_pointer_t<T>>();
6799 else
6800 return type_info<type_name function_type_getter_helper<decltype(&T::operator())>::type>;
6801 }
6802 template<typename T>
6803 struct function_type_getter{
6804 typedef decltype(function_type_getter_conditional_helper<T>())::template_name type type;
6805 };
6806
6807 /*
6808 获取一个callable类型的“函数类型”
6809 如T(int)返回char,其函数类型便是char(int)
6810 */
6811 template<typename T>
6812 using get_function_type=function_type_getter<T>::type;
6813
6814 /*
6815 用处:容纳一个callable类型(除过函数类型,但可以是其指针)并提供operator()
6816 小包装工具,能在意想不到的地方发挥效果(比如要额外携带数据的callable类型定义!见"../../lib_loader/lib_loader.hpp")
6817 */
6818 template<class T,class Func_t=get_function_type<T>>
6819 class function_data_warpper_t;
6820 template<class T,class Ret_t,class...Args_t>
6821 struct function_data_warpper_t<T,Ret_t(Args_t...)noexcept>{
6822 static_assert(!::std::is_function_v<T>);
6823
6824 T _value;
6825
6826 function_data_warpper_t(T a)noexcept(construct<T>.nothrow<T>):_value(a){}
6827 ~function_data_warpper_t()noexcept(destruct.nothrow<T>)=default;
6828 Ret_t operator()(Args_t...args)noexcept{
6829 //BLOCK:constexpr checks
6830 if constexpr(!invoke<T>.able<Args_t...>)
6831 template_error("this T can\'t becall as args.");
6832 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6833 template_error("the return type of T was wrong.");
6834 //BLOCK_END
6835 if constexpr(type_info<Ret_t> != type_info<void>)
6836 return _value(forward<Args_t>(args)...);
6837 else
6838 _value(forward<Args_t>(args)...);
6839 }
6840 Ret_t operator()(Args_t...args)const noexcept requires(invoke<const T>.able<Args_t...>){
6841 //BLOCK:constexpr checks
6842 if constexpr(!invoke<T>.able<Args_t...>)
6843 template_error("this T can\'t becall as args.");
6844 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6845 template_error("the return type of T was wrong.");
6846 //BLOCK_END
6847 if constexpr(type_info<Ret_t> != type_info<void>)
6848 return _value(forward<Args_t>(args)...);
6849 else
6850 _value(forward<Args_t>(args)...);
6851 }
6852 [[nodiscard]]auto&get_data()noexcept{return _value;}
6853 };
6854 /*
6855 用处:容纳一个callable类型(除过函数类型,但可以是其指针)并提供operator()
6856 小包装工具,能在意想不到的地方发挥效果(比如要额外携带数据的callable类型定义!见"../../lib_loader/lib_loader.hpp")
6857 */
6858 template<class T,class Ret_t,class...Args_t>
6859 struct function_data_warpper_t<T,Ret_t(Args_t...)>{
6860 static_assert(!::std::is_function_v<T>);
6861
6862 T _value;
6863
6864 function_data_warpper_t(T a)noexcept(construct<T>.nothrow<T>):_value(a){}
6865 ~function_data_warpper_t()noexcept(destruct.nothrow<T>)=default;
6866 Ret_t operator()(Args_t...args)noexcept(invoke<T>.nothrow<Args_t...>){
6867 //BLOCK:constexpr checks
6868 if constexpr(!invoke<T>.able<Args_t...>)
6869 template_error("this T can\'t becall as args.");
6870 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6871 template_error("the return type of T was wrong.");
6872 //BLOCK_END
6873 if constexpr(type_info<Ret_t> != type_info<void>)
6874 return _value(forward<Args_t>(args)...);
6875 else
6876 _value(forward<Args_t>(args)...);
6877 }
6878 Ret_t operator()(Args_t...args)const noexcept(invoke<const T>.nothrow<Args_t...>) requires(invoke<const T>.able<Args_t...>){
6879 //BLOCK:constexpr checks
6880 if constexpr(!invoke<T>.able<Args_t...>)
6881 template_error("this T can\'t becall as args.");
6882 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6883 template_error("the return type of T was wrong.");
6884 //BLOCK_END
6885 if constexpr(type_info<Ret_t> != type_info<void>)
6886 return _value(forward<Args_t>(args)...);
6887 else
6888 _value(forward<Args_t>(args)...);
6889 }
6890 [[nodiscard]]auto&get_data()noexcept{return _value;}
6891 [[nodiscard]]const auto&get_data()const noexcept{return _value;}
6892 };
6893 #endif
6894 }
6895 using function_base_n::get_function_type;
6896 using function_base_n::function_data_warpper_t;
6897
6898 //file_end
6899
6900 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6901
6902 //file_end
6903
6904 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
6905 }
6906
6907 namespace memory{
6908 //依赖list
6909 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
6910 //_body.hpp
6911 //at namespace elc::defs::memory
6912 /*
6913 未完成的elc解释器base文件
6914 由steve02081504与Alex0125设计、编写
6915 转载时请在不对此文件做任何修改的同时注明出处
6916 项目地址:https://github.com/steve02081504/ELC
6917 */
6918 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
6919 //_body.hpp
6920 //at namespace elc::defs::memory
6921 /*
6922 未完成的elc解释器base文件
6923 由steve02081504与Alex0125设计、编写
6924 转载时请在不对此文件做任何修改的同时注明出处
6925 项目地址:https://github.com/steve02081504/ELC
6926 */
6927 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/defs.hpp"
6928 //defs.hpp
6929 //at namespace elc::defs::memory
6930 /*
6931 未完成的elc解释器base文件
6932 由steve02081504与Alex0125设计、编写
6933 转载时请在不对此文件做任何修改的同时注明出处
6934 项目地址:https://github.com/steve02081504/ELC
6935 */
6936 namespace gc_n{
6937 void gc_for_alloc()noexcept;
6938 }
6939 namespace alloc_n{
6940 using ::elc::defs::memory::gc_n::gc_for_alloc;
6941
6942 //允许自定义对象的alloc/free/realloc/get_size_of_alloc方法:为pool留的后门(大概)
6943 //这里是缺省时的默认方法定义
6944 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/default_method/defs.hpp"
6945 //defs.hpp
6946 //at namespace elc::defs::memory::alloc_n
6947 /*
6948 未完成的elc解释器base文件
6949 由steve02081504与Alex0125设计、编写
6950 转载时请在不对此文件做任何修改的同时注明出处
6951 项目地址:https://github.com/steve02081504/ELC
6952 */
6953 namespace default_method{
6954 //BLOCK:for debug
6955 #if defined(_MSC_VER)
6956 #if defined(ELC_TEST_CHECK_MEMORY_LACK)
6957 #pragma detect_mismatch("ELC_TEST_CHECK_MEMORY_LACK","true")
6958 #else
6959 #pragma detect_mismatch("ELC_TEST_CHECK_MEMORY_LACK","false")
6960 #endif
6961 #endif
6962
6963 [[nodiscard]]inline byte*base_realloc(byte*ptr,size_t nsize,size_t align)noexcept{
6964 byte*p=::elc::APIs::alloc::realloc(ptr,nsize,align);
6965 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
6966 if(nsize==0)
6967 stest_uneventlog(ptr);
6968 if(p){
6969 ELC_TEST_EVENTNAME("base_realloc调用");
6970 if(p!=ptr)
6971 stest_uneventlog(ptr);
6972 stest_eventlog(p);
6973 }
6974 #endif
6975 return p;
6976 }
6977 [[nodiscard]]inline byte*base_aligned_alloc(size_t align,size_t size)noexcept{
6978 byte*p=::elc::APIs::alloc::aligned_alloc(align,size);
6979 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
6980 if(p){
6981 ELC_TEST_EVENTNAME("base_aligned_alloc调用");
6982 stest_eventlog(p);
6983 }
6984 #endif
6985 return p;
6986 }
6987 inline void base_free(byte*p,size_t align)noexcept{
6988 //传入需释放的数据块起始点与大小(字节)
6989 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
6990 auto tmp=stest_geteventlistfromlog(p);
6991 if(!tmp){
6992 stest_putsf(L"释放了已释放或未分配指针%p,当前的事件记录如下:",p);
6993 stest_printeventlist(stderr,stest_geteventlist());
6994 stest_wait();
6995 return;
6996 }else{
6997 stest_deleteevent(tmp);
6998 stest_uneventlog(p);
6999 }
7000 #endif
7001 ::elc::APIs::alloc::free(p,align);
7002 }
7003 inline size_t base_get_size_of_alloc(const byte*arg, size_t align)noexcept{
7004 //arg保证不与null_ptr相等
7005 const auto tmp= ::elc::APIs::alloc::get_size_of_alloc(arg,align);
7006 return tmp;
7007 }
7008 //BLOCK_END
7009
7010 template<typename T>
7011 inline void*alloc_method(type_info_t<T>)noexcept{
7012 //return空指针被允许,会引起gc_for_alloc
7013 return ::std::assume_aligned<alignof(T)>(base_aligned_alloc(alignof(T),sizeof(T)));
7014 }
7015 template<typename T>
7016 inline void*alloc_method(type_info_t<T>,size_t size)noexcept{
7017 //return空指针被允许,会引起gc_for_alloc
7018 //size被保证不为0
7019 if constexpr(type_info<T>.has_attribute(never_in_array))
7020 template_error("You cannot perform array operations on never_in_array type.");
7021 return ::std::assume_aligned<alignof(T)>(base_aligned_alloc(alignof(T),sizeof(T)*size));
7022 }
7023 template<typename T>
7024 inline size_t get_size_of_alloc_method(const T*arg)noexcept{
7025 //arg保证不与null_ptr相等
7026 return base_get_size_of_alloc(cast_to_data(arg),alignof(T))/sizeof(T);
7027 }
7028 template<typename T>
7029 inline void free_method(T*arg)noexcept{
7030 base_free(cast_to_data(arg),alignof(T));
7031 }
7032 template<typename T>
7033 inline void*realloc_method(T*&ptr,size_t new_size)noexcept{
7034 //return空指针被允许,会引起gc_for_alloc,但ptr值必须保持有效以保证gc_for_alloc后再次realloc有效
7035 //new_size被保证不为0
7036 //align维持不变
7037 //但只允许在扩大数据块时可选的移动数据块
7038 if constexpr(type_info<T>.has_attribute(never_in_array))
7039 template_error("You cannot perform array operations on never_in_array type.");
7040 return ptr=reinterpret_cast<T*>(base_realloc(cast_to_data(ptr),sizeof(T)*new_size,alignof(T)));
7041 }
7042 }
7043
7044 //file_end
7045
7046 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/defs.hpp"
7047
7048 enable_adl(the_alloc_method);
7049 template<typename T>
7050 inline void*alloc_method(type_info_t<T>)noexcept{
7051 //return空指针被允许,会引起gc_for_alloc
7052 if constexpr(was_not_an_ill_form(the_alloc_method(type_info<T>)))
7053 return the_alloc_method(type_info<T>);
7054 else
7055 return default_method::alloc_method(type_info<T>);
7056 }
7057 template<typename T>
7058 inline void*alloc_method(type_info_t<T>,size_t size)noexcept{
7059 //return空指针被允许,会引起gc_for_alloc
7060 //size被保证不为0
7061 if constexpr(was_not_an_ill_form(the_alloc_method(type_info<T>,size)))
7062 return the_alloc_method(type_info<T>,size);
7063 else
7064 return default_method::alloc_method(type_info<T>,size);
7065 }
7066 enable_adl(the_get_size_of_alloc_method);
7067 template<typename T>
7068 inline size_t get_size_of_alloc_method(const T*arg)noexcept{
7069 //arg保证不与null_ptr相等
7071 return the_get_size_of_alloc_method(arg);
7072 else
7073 return default_method::get_size_of_alloc_method(arg);
7074 }
7075 enable_adl(the_free_method);
7076 template<typename T>
7077 inline void free_method(T*arg)noexcept{
7078 if constexpr(was_not_an_ill_form(the_free_method(arg)))
7079 the_free_method(arg);
7080 else
7081 default_method::free_method(arg);
7082 }
7083 enable_adl(the_realloc_method);
7084 template<typename T>
7085 inline void*realloc_method(T*&ptr,size_t new_size)noexcept{
7086 //return空指针被允许,会引起gc_for_alloc,但ptr值必须保持有效以保证gc_for_alloc后再次realloc有效
7087 //new_size被保证不为0
7088 //align维持不变
7089 //但只允许在扩大数据块时可选的移动数据块
7090 if constexpr(was_not_an_ill_form(the_realloc_method(ptr,new_size)))
7091 return the_realloc_method(ptr,new_size);
7092 else
7093 return default_method::realloc_method(ptr,new_size);
7094 }
7095
7096 //众所周知,cpp是面向对象语言.
7098 template<class T>
7101 [[nodiscard]]static T*base_call()noexcept{
7102 void*tmp;
7103 while(!assign(tmp,alloc_method(type_info<T>)))gc_for_alloc();
7104 return reinterpret_cast<T*>(tmp);
7105 }
7106 [[nodiscard]]static T*base_call(size_t size)noexcept{
7108 if constexpr(type_info<T>.has_attribute(never_in_array))
7109 template_error("You can\'t alloc an array for never_in_array type.");
7110 if(size){//null_ptr不一定等价于nullptr,请勿删除本行
7111 void*tmp;
7112 while(!assign(tmp,alloc_method(type_info<T>,size)))gc_for_alloc();
7113 return reinterpret_cast<T*>(tmp);
7114 }else return null_ptr;
7115 }
7116 [[nodiscard]]/*static*/force_inline T*operator()()const noexcept{return base_call();}
7117 [[nodiscard]]/*static*/force_inline T*operator()(size_t size)const noexcept{return base_call(size);}
7119 size_t _size;
7120 [[nodiscard]]force_inline T*operator()()const noexcept{return base_call(_size);}
7121 };
7122 [[nodiscard]]force_inline constexpr alloc_array_t operator[](size_t a)const noexcept{return{a};}
7123 };
7124 template<class T>
7125 constexpr alloc_t<T>alloc{};
7126
7127 constexpr struct free_t{
7129 template<class T>
7130 static void base_call(T*p)noexcept{
7132 if(p!=null_ptr)//null_ptr不一定等价于nullptr,请勿删除本行
7133 free_method(p);
7134 }
7135 template<class T>
7136 /*static*/force_inline void operator()(T*p)const noexcept{base_call(p);}
7137 }free{};
7138
7139 constexpr struct realloc_t{
7141 template<class T>
7142 static void base_call(T*&ptr,size_t nsize)noexcept{
7144 if constexpr(type_info<T>.has_attribute(never_in_array))
7145 template_error("You cannot perform array operations on never_in_array type.");
7146 //template_warning("For never_in_array type,realloc will free ptr when new_size=0 else do nothing.");
7147 if(nsize){//null_ptr不一定等价于nullptr,请勿删除本行
7148 if constexpr(type_info<T>.not_has_attribute(never_in_array))
7149 if(ptr!=null_ptr){//null_ptr不一定等价于nullptr,请勿删除本行
7150 while(!realloc_method(ptr,nsize))gc_for_alloc();
7151 }else
7152 ptr=alloc<T>(nsize);
7153 }else{
7154 free(ptr);
7155 ptr=null_ptr;
7156 }
7157 }
7158 template<class T>
7159 /*static*/force_inline void operator()(T*&ptr,size_t nsize)const noexcept{
7160 base_call(ptr,nsize);
7161 }
7163 size_t _size;
7164 template<class T>
7165 [[nodiscard]]force_inline T*operator()(T*&ptr)const noexcept{return base_call(ptr,_size);}
7166 };
7167 [[nodiscard]]force_inline constexpr realloc_array_t operator[](size_t a)const noexcept{return{a};}
7168 }realloc{};
7169
7170 constexpr struct get_size_of_alloc_t{
7171 template<typename T>
7172 static constexpr bool able=true;
7173 template<typename T>
7174 static constexpr bool nothrow=noexcept(get_size_of_alloc_method(declvalue(const T*)));
7175
7176 template<typename T> requires able<T>
7177 static size_t base_call(const T*arg)noexcept(nothrow<T>){
7179 if(arg==null_ptr)
7180 return 0;
7181 return get_size_of_alloc_method(arg);
7182 }
7183
7184 template<typename T> requires able<T>
7185 force_inline size_t operator()(const T*arg)const noexcept(nothrow<T>){
7186 return base_call(arg);
7187 }
7188 }get_size_of_alloc{};
7189
7190 constexpr struct copy_alloc_t{
7191 template<typename T>
7192 static constexpr bool able=true;
7193 template<typename T>
7194 static constexpr bool nothrow=get_size_of_alloc.nothrow<T>;
7195
7196 template<typename T> requires able<T>
7197 static T*base_call(const T*arg)noexcept(nothrow<T>){
7199 return alloc<T>(get_size_of_alloc(arg));
7200 }
7201
7202 template<typename T> requires able<T>
7203 force_inline T*operator()(const T*arg)const noexcept(nothrow<T>){
7204 return base_call(arg);
7205 }
7206 }copy_alloc{};
7207 }
7208
7209 //file_end
7210
7211 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
7212 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_export.hpp"
7213 //_export.hpp
7214 //at namespace elc::defs::memory
7215 /*
7216 未完成的elc解释器base文件
7217 由steve02081504与Alex0125设计、编写
7218 转载时请在不对此文件做任何修改的同时注明出处
7219 项目地址:https://github.com/steve02081504/ELC
7220 */
7221 #define export using alloc_n::
7222 export alloc;
7223 export free;
7224 export realloc;
7225 export get_size_of_alloc;
7226 export copy_alloc;
7227 #undef export
7228
7229 //file_end
7230
7231 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
7232 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
7233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_test.hpp"
7234 //_test.hpp
7235 //at namespace elc::defs::memory
7236 /*
7237 未完成的elc解释器base文件
7238 由steve02081504与Alex0125设计、编写
7239 转载时请在不对此文件做任何修改的同时注明出处
7240 项目地址:https://github.com/steve02081504/ELC
7241 */
7242 inline void check_memory_lack()noexcept{
7243 stest_mapeventlogwith(lambda(const void*p,steventlist*a)noexcept{
7244 stest_putsf(L"内存泄露于%p,分配自:",p);
7245 stest_printeventlist(stdout,stest_copyeventlist(a));
7246 //alloc_n::base_free(remove_const(p));
7247 //stest_puts(L"已释放");
7248 stest_wait();
7249 });
7250 }
7251 #if defined(ELC_TEST_ON)
7252 namespace alloc_n{
7253 //BLOCK:for debug
7254 inline void test(){
7255 ELC_TEST_EVENTNAME("alloc部分测试");
7256 using ::std::time;
7257 using ::std::rand;
7258 using ::std::srand;
7259 srand((unsigned int)time(nullptr));
7260 for(int i=rand()%100+40;i--;){
7261 int*p=alloc<int>(50);
7262 p[0]=72;
7263 stest_accert(get_size_of_alloc(p)==50);
7264 p[49]=rand();
7265 p[19]=666;
7266 realloc(p,20);
7267 stest_accert(get_size_of_alloc(p)==20);
7268 stest_accert(p[19]==666);
7269 stest_accert(p[0]==72);
7270 free(p);
7271 }
7272 check_memory_lack();
7273 }
7274 inline void test_log_out(){
7275 }
7276 inline void test_end(){
7277 }
7278 //BLOCK_END
7279 }
7280 #endif
7281
7282 //file_end
7283
7284 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
7285 #endif
7286
7287 //file_end
7288
7289 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
7290 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7291 //_body.hpp
7292 //at namespace elc::defs::memory
7293 /*
7294 未完成的elc解释器base文件
7295 由steve02081504与Alex0125设计、编写
7296 转载时请在不对此文件做任何修改的同时注明出处
7297 项目地址:https://github.com/steve02081504/ELC
7298 */
7299 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/defs.hpp"
7300 //defs.hpp
7301 //at namespace elc::defs::memory
7302 /*
7303 未完成的elc解释器base文件
7304 由steve02081504与Alex0125设计、编写
7305 转载时请在不对此文件做任何修改的同时注明出处
7306 项目地址:https://github.com/steve02081504/ELC
7307 */
7308 namespace abstract_base_n{
7309 /*
7310 ELC的虚基类模块,适用于unget
7311 处理虚基类到实例类的偏移与模板实例化差异
7312 原理:
7313 虚函数间接调用以从base_t&转为T&
7314 运行时计算偏移以从T*转换base_t*
7315 用法:is_common_attribute␁
7316 */
7318 }
7319 namespace get_n{
7321 //struct build_by_get_only{};已定义于 "../../base_defs/special_attribute.hpp"
7322
7323 /*向后减小数据块大小并转移原有实例的生命周期,但并不析构旧的实例*/
7324 template<typename T>
7325 void alloc_size_cut(T*&arg,size_t to_size)noexcept{
7326 realloc(arg,to_size);
7327 }
7328 /*向后扩大数据块大小并转移原有实例的生命周期,但并不构造新的实例*/
7329 template<typename T>
7330 void alloc_size_grow(T*&arg,size_t to_size)noexcept(move.trivial<T> or move.nothrow<T>){
7331 if constexpr(move.trivial<T>)
7332 realloc(arg,to_size);
7333 else{
7334 T*tmp=alloc<T>(to_size);
7335 auto from_size=get_size_of_alloc(arg);
7336 if constexpr(!move.nothrow<T>){
7337 template_warning("the move of T was not noexcept,this may cause memory lack.");
7338 try{
7339 move[from_size](note::from(arg),note::to(tmp));
7340 }catch(...){
7341 free(tmp);
7342 throw;
7343 }
7344 }else{
7345 move[from_size](note::from(arg),note::to(tmp));
7346 }
7347 free(arg);
7348 arg=tmp;
7349 }
7350 }
7351 /*在指定位置插入未初始化数据块并转移原有实例的生命周期,但并不构造新的实例*/
7352 template<typename T>
7353 void alloc_size_grow_with_insert_uninitialized_data(T*&arg,size_t insert_pos,size_t insert_size)noexcept(move.trivial<T> or move.nothrow<T>){
7354 const auto from_size=get_size_of_alloc(arg);
7355 const auto to_size=from_size+insert_size;
7356 const auto size_before_insert=insert_pos;
7357 const auto size_after_insert=from_size-insert_pos;
7358 if constexpr(move.trivial<T>){
7359 realloc(arg,to_size);
7360 memmove(arg+size_before_insert+insert_size,arg+size_before_insert,size_after_insert*sizeof(T));
7361 }
7362 else{
7363 T*tmp=alloc<T>(to_size);
7364 if constexpr(!move.nothrow<T>){
7365 template_warning("the move of T was not noexcept,this may cause memory lack.");
7366 try{
7367 move[size_before_insert](note::from(arg),note::to(tmp));
7368 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7369 }catch(...){
7370 free(tmp);
7371 throw;
7372 }
7373 }else{
7374 move[size_before_insert](note::from(arg),note::to(tmp));
7375 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7376 }
7377 free(arg);
7378 arg=tmp;
7379 }
7380 }
7381 /*
7382 在指定位置插入未初始化数据块并转移原有实例的生命周期,但并不构造新的实例
7383 若有多余的大小,追加到末尾
7384 返回多余的大小
7385 */
7386 template<typename T>
7387 size_t alloc_size_grow_with_insert_uninitialized_data(T*&arg,size_t to_size,size_t insert_pos,size_t insert_size)noexcept(move.trivial<T> or move.nothrow<T>){
7388 const auto from_size=get_size_of_alloc(arg);
7389 const auto size_before_insert=insert_pos;
7390 const auto size_after_insert=from_size-insert_pos;
7391 if constexpr(move.trivial<T>){
7392 realloc(arg,to_size);
7393 memmove(arg+size_before_insert+insert_size,arg+size_before_insert,size_after_insert*sizeof(T));
7394 }
7395 else{
7396 T*tmp=alloc<T>(to_size);
7397 if constexpr(!move.nothrow<T>){
7398 template_warning("the move of T was not noexcept,this may cause memory lack.");
7399 try{
7400 move[size_before_insert](note::from(arg),note::to(tmp));
7401 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7402 }catch(...){
7403 free(tmp);
7404 throw;
7405 }
7406 }else{
7407 move[size_before_insert](note::from(arg),note::to(tmp));
7408 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7409 }
7410 free(arg);
7411 arg=tmp;
7412 }
7413 return to_size-from_size-insert_size;
7414 }
7415 /*向前减小数据块大小并转移原有实例的生命周期,但并不析构旧的实例*/
7416 template<typename T>
7417 void forward_alloc_size_cut(T*&arg,size_t to_size)noexcept(move.trivial<T> or move.nothrow<T>){
7418 const auto from_size=get_size_of_alloc(arg);
7419 const auto cut_size=from_size-to_size;
7420 if constexpr(move.trivial<T>){
7421 ::std::memmove(arg,add_const(arg+cut_size),to_size*sizeof(T));
7422 realloc(arg,to_size);
7423 }
7424 else{
7425 T*tmp=alloc<T>(to_size);
7426 if constexpr(!move.nothrow<T>){
7427 template_warning("the move of T was not noexcept,this may cause memory lack.");
7428 try{
7429 move[to_size](note::from(arg+cut_size),note::to(tmp));
7430 }catch(...){
7431 free(tmp);
7432 throw;
7433 }
7434 }else{
7435 move[to_size](note::from(arg+cut_size),note::to(tmp));
7436 }
7437 free(arg);
7438 arg=tmp;
7439 }
7440 }
7441 /*向前扩大数据块大小并转移原有实例的生命周期,但并不构造新的实例*/
7442 template<typename T>
7443 void forward_alloc_size_grow(T*&arg,size_t to_size)noexcept(move.trivial<T> or move.nothrow<T>){
7444 const auto from_size=get_size_of_alloc(arg);
7445 const auto grow_size=to_size-from_size;
7446 if constexpr(move.trivial<T>){
7447 realloc(arg,to_size);
7448 ::std::memmove(arg+grow_size,add_const(arg),from_size*sizeof(T));
7449 }
7450 else{
7451 T*tmp=alloc<T>(to_size);
7452 if constexpr(!move.nothrow<T>){
7453 template_warning("the move of T was not noexcept,this may cause memory lack.");
7454 try{
7455 move[from_size](note::from(arg),note::to(tmp+grow_size));
7456 }catch(...){
7457 free(tmp);
7458 throw;
7459 }
7460 }else{
7461 move[from_size](note::from(arg),note::to(tmp+grow_size));
7462 }
7463 free(arg);
7464 arg=tmp;
7465 }
7466 }
7467 /*
7468 在指定位置插入未初始化数据块并转移原有实例的生命周期,但并不构造新的实例
7469 若有多余的大小,追加到前端
7470 返回多余的大小
7471 */
7472 template<typename T>
7473 size_t forward_alloc_size_grow_with_insert_uninitialized_data(T*&arg,size_t to_size,size_t insert_pos,size_t insert_size)noexcept(move.trivial<T> or move.nothrow<T>){
7474 const auto from_size=get_size_of_alloc(arg);
7475 const auto grow_size=to_size-from_size;
7476 const auto before_grow_size=grow_size-insert_size;
7477 const auto size_before_insert=insert_pos;
7478 const auto size_after_insert=from_size-insert_pos;
7479 if constexpr(move.trivial<T>){
7480 realloc(arg,to_size);
7481 const auto orogin_data_ptr=arg+before_grow_size;
7482 ::std::memmove(orogin_data_ptr+size_before_insert+insert_size,arg+size_before_insert,size_after_insert*sizeof(T));
7483 ::std::memmove(orogin_data_ptr,arg,size_before_insert*sizeof(T));
7484 }
7485 else{
7486 T*tmp=alloc<T>(to_size);
7487 if constexpr(!move.nothrow<T>){
7488 template_warning("the move of T was not noexcept,this may cause memory lack.");
7489 try{
7490 const auto orogin_data_ptr=tmp+before_grow_size;
7491 move[size_before_insert](note::from(arg),note::to(orogin_data_ptr));
7492 move[size_after_insert](note::from(arg+size_before_insert),note::to(orogin_data_ptr+size_before_insert+insert_size));
7493 }catch(...){
7494 free(tmp);
7495 throw;
7496 }
7497 }else{
7498 const auto orogin_data_ptr=tmp+before_grow_size;
7499 move[size_before_insert](note::from(arg),note::to(orogin_data_ptr));
7500 move[size_after_insert](note::from(arg+size_before_insert),note::to(orogin_data_ptr+size_before_insert+insert_size));
7501 }
7502 free(arg);
7503 arg=tmp;
7504 }
7505 return before_grow_size;
7506 }
7507
7508 struct base_get_t{};
7509 template<typename T>
7512 template<class...Args>
7513 static constexpr bool able=construct<T>.able<Args...>&&destruct.able<T>;
7514 template<class...Args>
7515 static constexpr bool nothrow=construct<T>.nothrow<Args...>;
7516
7517 template<class...Args> requires able<Args...>
7518 [[nodiscard]]T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
7520 return construct<T>[alloc<T>()](forward<Args>(rest)...);
7521 }
7522
7524 size_t _size;
7525 template<class...Args> requires able<Args...>
7526 [[nodiscard]]T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
7528 if constexpr(type_info<T>.has_attribute(never_in_array))
7529 template_error("You can\'t get an array for never_in_array type.");
7530 return construct<T>[alloc<T>(_size)][_size](forward<Args>(rest)...);
7531 }
7532 };
7533 [[nodiscard]]constexpr array_get_t operator[](size_t size)const noexcept{return{size};}
7534
7535 static constexpr struct as_array_t{
7536 template<typename U>
7537 static constexpr bool able=copy_construct.able<T>&&destruct.able<T>&&is_array_like_for<T,U>;
7538 template<typename U>
7539 static constexpr bool nothrow=copy_construct.nothrow<T>;
7540
7541 [[nodiscard]]T* operator()(array_like_view_t<const T>a)const noexcept(nothrow<void>){
7543 if constexpr(type_info<T>.has_attribute(never_in_array))
7544 template_error("You can\'t get an array for never_in_array type.");
7545 auto size=a.size();
7546 auto aret=alloc<T>[size]();
7547 copy_construct[size](note::from(a.begin()),note::to(aret));
7548 return aret;
7549 }
7550 }as_array{};
7551
7552 static constexpr struct apply_end_t{
7553 template<typename U>
7554 static constexpr bool able=copy_construct.able<T>&&move.able<T>&&is_array_like_for<T,U>;
7555 template<typename U>
7556 static constexpr bool nothrow=copy_construct.nothrow<T>&&move.nothrow<T>;
7557
7558 T* operator()(note::to_t<T*&> to,array_like_view_t<const T>a)const noexcept(nothrow<void>){
7560 auto&ptr=to.value;
7561 auto from_size=get_size_of_alloc(ptr);
7562 auto a_size=a.size();
7563 alloc_size_grow(ptr,from_size+a_size);
7564 copy_construct[a_size](note::from(a.begin()),note::to(ptr+from_size));
7565 return ptr;
7566 }
7567 T* operator()(note::to_t<T*&> to,const T&a)const noexcept(nothrow<void>){
7569 auto&ptr=to.value;
7570 auto from_size=get_size_of_alloc(ptr);
7571 alloc_size_grow(ptr,from_size+1);
7572 copy_construct(note::from(&a),note::to(ptr+from_size));
7573 return ptr;
7574 }
7575 T* operator()(note::to_t<T*&> to,T&&a)const noexcept(nothrow<void>){
7577 auto&ptr=to.value;
7578 auto from_size=get_size_of_alloc(ptr);
7579 alloc_size_grow(ptr,from_size+1);
7580 move_construct(note::from(&a),note::to(ptr+from_size));
7581 return ptr;
7582 }
7583 }apply_end{};
7584
7585 static constexpr struct remove_t{
7586 template<typename U>
7587 static constexpr bool able=destruct.able<T>&&move.able<T>&&is_array_like_for<T,U>;
7588 template<typename U>
7589 static constexpr bool nothrow=destruct.nothrow<T>&&move.nothrow<T>;
7590
7591 bool operator()(array_like_view_t<const T>a,note::from_t<T*>from)const noexcept(nothrow<void>){
7593 auto ptr=from.value;
7594 auto from_size=get_size_of_alloc(ptr);
7595 T*ptr_to_a=in_range(a,{ptr,note::size(from_size)});
7596 auto a_size=a.size();
7597 if(!ptr_to_a)
7598 return false;
7599
7600 destruct[a_size](ptr_to_a);
7601 move[(ptr+from_size)-(ptr_to_a+a_size)](note::from(ptr_to_a+a_size),note::to(ptr_to_a));
7602 alloc_size_cut(ptr,from_size-a_size);
7603 return true;
7604 }
7605 }remove{};
7606 };
7607 template<typename T>
7608 constexpr get_t<T>get{};
7609
7610
7611 constexpr struct unget_t{
7612 template<typename T>
7613 static constexpr bool able=destruct.able<T>;
7614 template<typename T>
7615 static constexpr bool nothrow=destruct.nothrow<T>;
7616
7617 template<typename T> requires able<T>
7618 void operator()(T*a)const noexcept(nothrow<T>){
7620 if(a!=null_ptr){
7621 if constexpr(type_info<T>.has_attribute(abstract_base))
7622 #if defined(_MSC_VER)
7623 [[gsl::suppress(f.6)]]
7624 #endif
7625 attribute_ptr_cast<abstract_base>(a)->abstract_method_unget_this();
7626 else{
7627 if constexpr(!destruct.nothrow<T>)
7628 template_warning("the destructer of T was not noexcept,this may cause memory lack.");
7629 if constexpr(type_info<T>.has_attribute(never_in_array))
7630 destruct(a);
7631 else
7632 destruct[get_size_of_alloc(a)](a);
7633 free(a);
7634 }
7635 }
7636 }
7637 /*适用于unget(this,not destruct);*/
7638 template<typename T> requires able<T>
7639 void operator()(T*a,decltype(destruct)::not_t)const noexcept(nothrow<T>){
7641 free(a);
7642 }
7643 }unget{};
7644
7645 constexpr struct get_resize_t{
7646 template<typename T>
7647 static constexpr bool able=construct<T>.able<>&&destruct.able<T>&&move.able<T>;
7648 template<typename T>
7649 static constexpr bool nothrow=type_info<T>.not_has_attribute(abstract_base)&&construct<T>.nothrow<>&&destruct.nothrow<T>&&move.nothrow<T>;
7650
7651 template<typename T> requires able<T>
7652 static void base_call(T*&arg,const size_t to_size)noexcept(nothrow<T>){
7653 if constexpr(type_info<T>.has_attribute(never_in_array)){
7654 template_warning("For never_in_array type,get_resize will unget ptr when new_size=0 else do nothing.");
7655 if(to_size)
7656 return;
7657 unget(arg);
7658 arg=null_ptr;
7659 }elseif constexpr(type_info<T>.has_attribute(abstract_base)){
7660 arg=attribute_ptr_cast<abstract_base>(arg)->abstract_method_get_resize_this(to_size);
7661 }else{
7662 const size_t from_size=get_size_of_alloc(arg);
7663 if(from_size==to_size)
7664 return;
7665 elseif(from_size > to_size){
7666 destruct[from_size-to_size](arg+to_size);
7667 alloc_size_cut(arg,to_size);
7668 }elseif(from_size){
7669 alloc_size_grow(arg,to_size);
7670 construct<T>[arg+from_size][to_size-from_size]();
7671 }else
7672 arg=get<T>[to_size]();
7673 }
7674 }
7675
7676 template<typename T> requires able<T>
7677 inline void operator()(T*&arg,size_t to_size)const noexcept(nothrow<T>){
7679 base_call(arg,to_size);
7680 }
7681 template<typename T> requires able<T>
7682 [[nodiscard]]inline T* operator()(T*&&arg,size_t to_size)const noexcept(nothrow<T>){
7684 base_call(arg,to_size);
7685 return arg;
7686 }
7687
7688 static constexpr struct insert_t{
7689 template<typename T>
7690 static constexpr bool able=get_resize_t::able<T>;
7691 template<typename T>
7692 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7693 template<typename T> requires(able<T> && construct<T>.able<>)
7694 void operator()(T*&arg,size_t insert_pos,size_t insert_size)const noexcept(nothrow<T>){
7695 if(insert_size){
7697 alloc_size_grow_with_insert_uninitialized_data(arg,insert_pos,insert_size);
7698 construct<T>[arg+insert_pos][insert_size]();
7699 }
7700 }
7701 template<typename T> requires(able<T> && copy_construct.able<T>)
7702 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data)const noexcept(nothrow<T>){
7703 if(insert_size){
7705 alloc_size_grow_with_insert_uninitialized_data(arg,insert_pos,insert_size);
7706 copy_construct[insert_size](note::from(insert_data),note::to(arg+insert_pos));
7707 }
7708 }
7709 }insert{};
7710 static constexpr struct insert_resize_t{
7711 template<typename T>
7712 static constexpr bool able=get_resize_t::able<T>;
7713 template<typename T>
7714 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7715 template<typename T> requires(able<T> && construct<T>.able<> && copy_construct.able<T>)
7716 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data,size_t to_size)const noexcept(nothrow<T>){
7718 auto end_grow_size=alloc_size_grow_with_insert_uninitialized_data(arg,to_size,insert_pos,insert_size);
7719 copy_construct[insert_size](note::from(insert_data),note::to(arg+insert_pos));
7720 construct<T>[arg+to_size-end_grow_size][end_grow_size]();
7721 }
7722 }insert_with_resize{};
7723 }get_resize{};
7724
7725 constexpr struct get_forward_resize_t{
7726 template<typename T>
7727 static constexpr bool able=construct<T>.able<>&&destruct.able<T>&&move.able<T>;
7728 template<typename T>
7729 static constexpr bool nothrow=type_info<T>.not_has_attribute(abstract_base)&&construct<T>.nothrow<>&&destruct.nothrow<T>&&move.nothrow<T>;
7730
7731 template<typename T> requires able<T>
7732 static void base_call(T*&arg,const size_t to_size)noexcept(nothrow<T>){
7734 if constexpr(type_info<T>.has_attribute(never_in_array)){
7735 template_warning("For never_in_array type,get_forward_resize will unget ptr when new_size=0 else do nothing.");
7736 if(to_size)
7737 return;
7738 unget(arg);
7739 arg=null_ptr;
7740 }elseif constexpr(type_info<T>.has_attribute(abstract_base)){
7741 arg=attribute_ptr_cast<abstract_base>(arg)->abstract_method_get_forward_resize_this(to_size);
7742 }else{
7743 const size_t from_size=get_size_of_alloc(arg);
7744 if(from_size==to_size)
7745 return;
7746 elseif(from_size > to_size){
7747 destruct[from_size-to_size](arg);
7748 forward_alloc_size_cut(arg,to_size);
7749 }elseif(from_size){
7750 forward_alloc_size_grow(arg,to_size);
7751 construct<T>[arg][to_size-from_size]();
7752 }else
7753 arg=get<T>[to_size]();
7754 }
7755 }
7756
7757 template<typename T> requires able<T>
7758 inline void operator()(T*&arg,size_t to_size)const noexcept(nothrow<T>){
7759 base_call(arg,to_size);
7760 }
7761 template<typename T> requires able<T>
7762 [[nodiscard]]inline T* operator()(T*&&arg,size_t to_size)const noexcept(nothrow<T>){
7763 base_call(arg,to_size);
7764 return arg;
7765 }
7766
7767 static constexpr struct insert_t{
7768 template<typename T>
7769 static constexpr bool able=get_resize_t::able<T>;
7770 template<typename T>
7771 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7772 template<typename T> requires(able<T> && construct<T>.able<>)
7773 void operator()(T*&arg,size_t insert_pos,size_t insert_size)const noexcept(nothrow<T>){
7775 get_resize.insert(arg,insert_pos,insert_size);
7776 }
7777 template<typename T> requires(able<T> && copy_construct.able<T>)
7778 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data)const noexcept(nothrow<T>){
7780 get_resize.insert(arg,insert_pos,insert_size,insert_data);
7781 }
7782 }insert{};
7783 static constexpr struct insert_resize_t{
7784 template<typename T>
7785 static constexpr bool able=get_resize_t::able<T>;
7786 template<typename T>
7787 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7788 template<typename T> requires(able<T> && construct<T>.able<> && copy_construct.able<T>)
7789 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data,size_t to_size)const noexcept(nothrow<T>){
7790 if(insert_size){
7792 auto before_grow_size=forward_alloc_size_grow_with_insert_uninitialized_data(arg,to_size,insert_pos,insert_size);
7793 const auto orogin_arg=arg+before_grow_size;
7794 copy_construct[insert_size](note::from(insert_data),note::to(orogin_arg+insert_pos));
7795 construct<T>[arg][before_grow_size]();
7796 }
7797 }
7798 }insert_with_resize{};
7799 }get_forward_resize{};
7800
7801 constexpr struct get_size_of_get_t{
7802 template<typename T>
7803 static constexpr bool able=true;
7804 template<typename T>
7805 static constexpr bool nothrow=noexcept(get_size_of_alloc(declvalue(const T*)));
7806
7807 template<typename T> requires able<T>
7808 static size_t base_call(const T*arg)noexcept(nothrow<T>){
7810 return get_size_of_alloc(arg);
7811 }
7812
7813 template<typename T> requires able<T>
7814 size_t operator()(const T*arg)const noexcept(nothrow<T>){
7815 return base_call(arg);
7816 }
7817 }get_size_of_get{};
7818
7819 constexpr struct copy_get_t{
7820 template<typename T>
7821 static constexpr bool able=copy_construct.able<T> || type_info<T>.has_attribute(abstract_base);
7822 template<typename T>
7823 static constexpr bool nothrow=copy_construct.nothrow<T>;
7824
7825 template<typename T> requires able<T>
7826 static T*base_call(const T*arg)noexcept(nothrow<T>){
7828 if constexpr(type_info<T>.has_attribute(abstract_base))
7829 return remove_const(attribute_ptr_cast<abstract_base>(arg))->abstract_method_copy_get_this();
7830 else
7831 return copy_construct(note::from(arg),note::to(copy_alloc(arg)),get_size_of_get(arg));
7832 }
7833
7834 template<typename T> requires able<T>
7835 T*operator()(const T*arg)const noexcept(nothrow<T>){
7836 return base_call(arg);
7837 }
7838 }copy_get{};
7839 }
7840
7841 //file_end
7842
7843 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7844 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_export.hpp"
7845 //_export.hpp
7846 //at namespace elc::defs::memory
7847 /*
7848 未完成的elc解释器base文件
7849 由steve02081504与Alex0125设计、编写
7850 转载时请在不对此文件做任何修改的同时注明出处
7851 项目地址:https://github.com/steve02081504/ELC
7852 */
7853 #define export using get_n::
7854 export get;
7855 export get_resize;
7856 export get_forward_resize;
7857 export unget;
7858 export get_size_of_get;
7859 export copy_get;
7860 //export build_by_get_only;
7861 #undef export
7862
7863 //file_end
7864
7865 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7866 #if defined(ELC_TEST_ON)
7867 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_test.hpp"
7868 //_test.hpp
7869 //at namespace elc::defs::memory
7870 /*
7871 未完成的elc解释器base文件
7872 由steve02081504与Alex0125设计、编写
7873 转载时请在不对此文件做任何修改的同时注明出处
7874 项目地址:https://github.com/steve02081504/ELC
7875 */
7876 namespace get_n{
7877 //BLOCK:for debug
7878 inline void test(){
7879 ELC_TEST_EVENTNAME("get部分测试");
7880 {
7881 ste::tester::setzero();
7882 tester*p=get<tester>[50]();
7883 stest_accert(tester::getbuildtime()==50);
7884 get_resize(p,60);
7885 //destroytime:50(+50) cause move(move_construct&destruct).
7886 stest_accert(tester::getdestroytime()==50);
7887 stest_accert(tester::getbuildtime()==60);
7888 int i=0;
7889 do
7890 p[i]();//写入测试
7891 while(++i!=60);
7892 stest_accert(tester::getcalltime()==60);
7893 unget(p);
7894 //destroytime:110(+60) cause destruct.
7895 stest_accert(tester::getdestroytime()==110);
7896 }
7897 check_memory_lack();
7898 }
7899 inline void test_log_out(){
7900 }
7901 inline void test_end(){
7902 }
7903 //BLOCK_END
7904 }
7905
7906 //file_end
7907
7908 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7909 #endif
7910
7911 //file_end
7912
7913 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
7914 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
7915 //_body.hpp
7916 //at namespace elc::defs::memory
7917 /*
7918 未完成的elc解释器base文件
7919 由steve02081504与Alex0125设计、编写
7920 转载时请在不对此文件做任何修改的同时注明出处
7921 项目地址:https://github.com/steve02081504/ELC
7922 */
7923 //UF
7924 namespace abstract_base_n{
7925 /*
7926 ELC的虚基类模块,适用于unget
7927 处理虚基类到实例类的偏移与模板实例化差异
7928 原理:
7929 虚函数间接调用以从base_t&转为T&
7930 运行时计算偏移以从T*转换base_t*
7931 用法:is_common_attribute␁
7932 */
7933 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/pointer_off_set.hpp"
7934 //pointer_off_set.hpp
7935 //at namespace elc::defs::memory::abstract_base_n
7936 /*
7937 未完成的elc解释器base文件
7938 由steve02081504与Alex0125设计、编写
7939 转载时请在不对此文件做任何修改的同时注明出处
7940 项目地址:https://github.com/steve02081504/ELC
7941 */
7942 inline thread_local pointer base_ptr;
7943 inline thread_local ptrdiff_t off_set;
7944 distinctive inline void is_base_ptr(void*a)noexcept{base_ptr=a;}
7945 distinctive inline void is_instance_ptr(void*a)noexcept{off_set=get_off_set(note::from(a),note::to(base_ptr));}
7946 distinctive inline void*get_ptr_after_off_set(void*a)noexcept{return apply_off_set(a,off_set);}
7947
7948 //file_end
7949
7950 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
7951 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/abstract_base_vtable.hpp"
7952 //abstract_base_vtable.hpp
7953 //at namespace elc::defs::memory::abstract_base_n
7954 /*
7955 未完成的elc解释器base文件
7956 由steve02081504与Alex0125设计、编写
7957 转载时请在不对此文件做任何修改的同时注明出处
7958 项目地址:https://github.com/steve02081504/ELC
7959 */
7961 protected:
7963 virtual void* _abstract_method_get_resize_this(size_t size)=0;
7964 virtual void* _abstract_method_get_forward_resize_this(size_t size)=0;
7965
7968
7969 friend class get_n::unget_t;
7970 friend class get_n::get_resize_t;
7971 friend class get_n::get_size_of_get_t;
7972 friend class get_n::copy_get_t;
7973 };
7974
7975 //file_end
7976
7977 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
7978 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/abstract_base.hpp"
7979 //abstract_base.hpp
7980 //at namespace elc::defs::memory::abstract_base_n
7981 /*
7982 未完成的elc解释器base文件
7983 由steve02081504与Alex0125设计、编写
7984 转载时请在不对此文件做任何修改的同时注明出处
7985 项目地址:https://github.com/steve02081504/ELC
7986 */
7987 template<class T>
7989 T* abstract_method_copy_get_this(){
7990 is_base_ptr(this);
7991 return reinterpret_cast<T*>(get_ptr_after_off_set(this->_abstract_method_copy_get_this()));
7992 }
7993 T* abstract_method_get_resize_this(size_t size){
7994 is_base_ptr(this);
7995 return reinterpret_cast<T*>(get_ptr_after_off_set(this->_abstract_method_get_resize_this(size)));
7996 }
7997 T* abstract_method_get_forward_resize_this(size_t size){
7998 is_base_ptr(this);
7999 return reinterpret_cast<T*>(get_ptr_after_off_set(this->_abstract_method_get_forward_resize_this(size)));
8000 }
8001
8002 friend class get_n::unget_t;
8005 friend class get_n::copy_get_t;
8006 };
8007
8008 //file_end
8009
8010 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
8011 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/instance_struct.hpp"
8012 //instance_struct.hpp
8013 //at namespace elc::defs::memory::abstract_base_n
8014 /*
8015 未完成的elc解释器base文件
8016 由steve02081504与Alex0125设计、编写
8017 转载时请在不对此文件做任何修改的同时注明出处
8018 项目地址:https://github.com/steve02081504/ELC
8019 */
8020 push_and_disable_msvc_warning(26436);//无虚析构函数警告diss
8021 template<class T>
8022 class instance_struct:is_common_attribute(instance_struct),virtual public abstract_base_vtable{
8023 protected:
8024 virtual void abstract_method_unget_this()noexcept_as(unget(get_handle(this)))override{unget(get_handle(this));}
8025 virtual void* _abstract_method_copy_get_this()noexcept(copy_get.able<T>?copy_get.nothrow<T>:1)override{
8026 if constexpr(copy_get.able<T>){
8027 is_instance_ptr(this);
8028 return copy_get(get_handle(this));
8029 }
8030 else{
8031 return get_handle(this);
8032 }
8033 }
8034 virtual void* _abstract_method_get_resize_this(size_t size)noexcept(get_resize.able<T>?get_resize.nothrow<T>:1)override{
8035 if constexpr(get_resize.able<T>){
8036 is_instance_ptr(this);
8037 return get_resize(get_handle(this),size);
8038 }
8039 else{
8040 return get_handle(this);
8041 }
8042 }
8043 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept(get_forward_resize.able<T>?get_forward_resize.nothrow<T>:1)override{
8044 if constexpr(get_forward_resize.able<T>){
8045 is_instance_ptr(this);
8046 return get_forward_resize(get_handle(this),size);
8047 }
8048 else{
8049 return get_handle(this);
8050 }
8051 }
8052 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return get_size_of_get(get_handle(this));}
8053 };
8055
8056 //file_end
8057
8058 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
8059 }
8060 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_export.hpp"
8061 //_export.hpp
8062 //at namespace elc::defs::memory
8063 /*
8064 未完成的elc解释器base文件
8065 由steve02081504与Alex0125设计、编写
8066 转载时请在不对此文件做任何修改的同时注明出处
8067 项目地址:https://github.com/steve02081504/ELC
8068 */
8069 #define export using abstract_base_n::
8070 export abstract_base;
8071 export instance_struct;
8072 #undef export
8073
8074 //file_end
8075
8076 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
8077
8078 //file_end
8079
8080 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8081
8082 //#include "pool/_body.hpp"//依赖list
8083
8084 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8085 //_body.hpp
8086 //at namespace elc::defs::memory
8087 /*
8088 未完成的elc解释器base文件
8089 由steve02081504与Alex0125设计、编写
8090 转载时请在不对此文件做任何修改的同时注明出处
8091 项目地址:https://github.com/steve02081504/ELC
8092 */
8093 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/defs.hpp"
8094 //defs.hpp
8095 //at namespace elc::defs::memory
8096 /*
8097 未完成的elc解释器base文件
8098 由steve02081504与Alex0125设计、编写
8099 转载时请在不对此文件做任何修改的同时注明出处
8100 项目地址:https://github.com/steve02081504/ELC
8101 */
8102 template<typename T>
8103 struct replace_able;
8104 namespace ptr_n{
8105 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8106 //_body.hpp
8107 //at namespace elc::defs::memory::ptr_n
8108 /*
8109 未完成的elc解释器base文件
8110 由steve02081504与Alex0125设计、编写
8111 转载时请在不对此文件做任何修改的同时注明出处
8112 项目地址:https://github.com/steve02081504/ELC
8113 */
8114 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/ref_t.hpp"
8115 //ref_t.hpp
8116 //at namespace elc::defs::memory::ptr_n
8117 /*
8118 未完成的elc解释器base文件
8119 由steve02081504与Alex0125设计、编写
8120 转载时请在不对此文件做任何修改的同时注明出处
8121 项目地址:https://github.com/steve02081504/ELC
8122 */
8123 typedef ::std::size_t link_num_t;
8125 mutable link_num_t _ref_num=0;
8126 public:
8127 constexpr ref_t()noexcept=default;
8128 constexpr explicit ref_t(never_ref_num_zero_t)noexcept:_ref_num(1){}
8129 constexpr inline void add_ref()const noexcept{_ref_num++;}
8130 [[nodiscard]]inline bool cut_ref()const noexcept{return!--_ref_num;}
8131 //[[nodiscard]]operator bool()const noexcept{return _ref_num;}
8132 inline void set_zero()noexcept{_ref_num=0;}
8133 constexpr inline void init_never_ref_num_zero()noexcept{add_ref();}
8134 [[nodiscard]]link_num_t link_num()const noexcept{return _ref_num;}
8135 };
8136
8137 //file_end
8138
8139 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8140 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/ref_base.hpp"
8141 //ref_base.hpp
8142 //at namespace elc::defs::memory::ptr_n
8143 /*
8144 未完成的elc解释器base文件
8145 由steve02081504与Alex0125设计、编写
8146 转载时请在不对此文件做任何修改的同时注明出处
8147 项目地址:https://github.com/steve02081504/ELC
8148 */
8149 enable_adl(the_waiting_for_destroy);
8150 template<typename T>
8151 void waiting_for_destroy(T*a)noexcept{
8153 return the_waiting_for_destroy(a);
8154 else
8155 template_error("this function should not be instantiated,please overload the function the_waiting_for_destroy in the namespace where this type is defined.");
8156 }
8157 enable_adl(the_destroy_and_free);
8158 template<typename T>
8159 void destroy_and_free(T*a)noexcept{
8161 return the_destroy_and_free(a);
8162 elseif constexpr(type_info<T>.has_attribute(build_by_get_only)&&type_info<T>.has_attribute(never_in_array))
8163 unget(a);
8164 else
8165 template_error("please overload the function the_destroy_and_free in the namespace where this type is defined.");
8166 }
8167 //
8168 common_attribute_t ref_able;
8169 common_attribute_t weak_ref_able;
8170
8171 template<typename T>
8172 constexpr bool was_ref_able=type_info<T>.has_attribute(ref_able);
8173 template<typename T>
8174 constexpr bool was_weak_ref_able=type_info<T>.has_attribute(weak_ref_able);
8175
8176 template<typename T>
8177 [[nodiscard]]link_num_t get_ref_num(const T*a)noexcept{
8178 if constexpr(!was_ref_able<T>)
8179 template_error("hey.");
8180 return attribute_ptr_cast<const ref_able>(a)->link_num();
8181 }
8182 template<typename T>
8183 [[nodiscard]]link_num_t get_weak_ref_num(const T*a)noexcept{
8184 if constexpr(!was_weak_ref_able<T>)
8185 template_error("hey.");
8186 return attribute_ptr_cast<const weak_ref_able>(a)->link_num();
8187 }
8188
8189 //file_end
8190
8191 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8192 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/ref_able.hpp"
8193 //ref_able.hpp
8194 //at namespace elc::defs::memory::ptr_n
8195 /*
8196 未完成的elc解释器base文件
8197 由steve02081504与Alex0125设计、编写
8198 转载时请在不对此文件做任何修改的同时注明出处
8199 项目地址:https://github.com/steve02081504/ELC
8200 */
8201 template<typename T>
8203 private:
8204 typedef ref_t base_t;
8205 public:
8206 using base_t::base_t;
8207 inline void cut_ref()const noexcept{
8208 T*this_T=remove_const(get_handle(this));
8209 if(base_t::cut_ref())
8210 if constexpr(was_weak_ref_able<T>)
8211 if(get_weak_ref_num(this_T)!=0)
8212 waiting_for_destroy(this_T);
8213 else
8214 destroy_and_free(this_T);
8215 else
8216 destroy_and_free(this_T);
8217 }
8218 };
8219
8220 //file_end
8221
8222 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8223 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/weak_ref_able.hpp"
8224 //weak_ref_able.hpp
8225 //at namespace elc::defs::memory::ptr_n
8226 /*
8227 未完成的elc解释器base文件
8228 由steve02081504与Alex0125设计、编写
8229 转载时请在不对此文件做任何修改的同时注明出处
8230 项目地址:https://github.com/steve02081504/ELC
8231 */
8232 template<typename T>
8234 private:
8235 typedef ref_t base_t;
8236 public:
8237 inline void cut_ref()const noexcept{
8238 if constexpr(!was_ref_able<T>)
8239 template_error("base on ref_able before base on weak_ref_able,please.");
8240 T*this_T=remove_const(get_handle(this));
8241 if(base_t::cut_ref())
8242 if(get_ref_num(this_T)==0)
8243 destroy_and_free(this_T);
8244 }
8245 };
8246
8247 //file_end
8248
8249 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8250
8251 //file_end
8252
8253 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/defs.hpp"
8254 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8255 //_body.hpp
8256 //at namespace elc::defs::memory::ptr_n
8257 /*
8258 未完成的elc解释器base文件
8259 由steve02081504与Alex0125设计、编写
8260 转载时请在不对此文件做任何修改的同时注明出处
8261 项目地址:https://github.com/steve02081504/ELC
8262 */
8263 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/base_ptr_t.hpp"
8264 //base_ptr_t.hpp
8265 //at namespace elc::defs::memory::ptr_n
8266 /*
8267 未完成的elc解释器base文件
8268 由steve02081504与Alex0125设计、编写
8269 转载时请在不对此文件做任何修改的同时注明出处
8270 项目地址:https://github.com/steve02081504/ELC
8271 */
8272 //copy from old ELC & adepted.
8273 template<class T>
8275 protected:
8276 mutable T*_to;
8277 explicit same_ptr_p_t(T*a)noexcept:_to(a){}
8278 public:
8279 same_ptr_p_t(const same_ptr_p_t&)noexcept=default;
8280 [[nodiscard]]T*get()const noexcept{return _to;}
8281 };
8282 template<class T,typename ref_type>
8284 using same_ptr_p_t<T>::_to;
8285 explicit same_ref_p_t(T*a)noexcept:same_ptr_p_t<T>(a){}
8286 explicit same_ref_p_t(const same_ptr_p_t<T>&a)noexcept:same_ptr_p_t<T>(a){}
8287
8288 void swap_with(same_ref_p_t&a)noexcept{swap(_to,a._to);}
8289
8290 static constexpr bool cut_nothrow=noexcept(declvalue(ref_type).cut_ref());
8291 protected:
8292 static void cut_ref(T*a)noexcept(cut_nothrow){attribute_ptr_cast<ref_type>(a)->cut_ref();}
8293 static void add_ref(T*a)noexcept{attribute_ptr_cast<ref_type>(a)->add_ref();}
8294
8295 void cut_ref()const noexcept_as(cut_ref(nullptr)){cut_ref(_to);}
8296 void add_ref()const noexcept{add_ref(_to);}
8297 };
8298
8299 template<class T,typename ref_type>
8301 a.swap_with(b);
8302 }
8303
8304 template<class T,typename ref_type,bool do_replace_check>
8305 struct ptr_t:same_ref_p_t<T,ref_type>{
8307
8311 using base_t::cut_nothrow;
8312 using same_ref::add_ref;
8313 using same_ref::cut_ref;
8314 using same_ref::swap_with;
8315 using same_ptr::_to;
8316
8317 explicit ptr_t(T*a,special_init_t)noexcept:same_ref(a){}
8318 constexpr ptr_t(T*a)noexcept:same_ref(a){add_ref();}
8319 ptr_t(const same_ptr&a)noexcept:same_ref(a){
8320 if constexpr(type_info<T>.has_attribute(weak_ref_able) && type_info<ref_type> == type_info<ref_able<remove_cv<T>>>)
8321 if(get_ref_num(_to))
8322 add_ref();
8323 else
8324 add_ref(_to=null_ptr);
8325 else
8326 add_ref();
8327 }
8328 ptr_t(const same_ref&a)noexcept:same_ref(a){add_ref();}
8329 ptr_t(const ptr_t&a)noexcept:ptr_t((same_ptr&)a){}
8330 ptr_t(const ptr_t<remove_cv<T>,ref_type,do_replace_check>&a)noexcept requires(type_info<remove_cv<T>>!=type_info<T>):ptr_t(a.get()){}
8331 ptr_t(ptr_t&&a)noexcept:ptr_t((same_ptr&)a){
8332 //为什么不默认构造后swap_with?
8333 /*
8334 直接构造:
8335 对目标进行addref
8336 移动对象析构(单次cutref)
8337 总耗费4
8338 默认构造后swap_with:
8339 对nullptr进行addref
8340 交换ptr值
8341 移动对象析构(单次cutref)
8342 总耗费6
8343
8344 总结:多此一举
8345 */
8346 }
8347 constexpr ptr_t(nullptr_t=nullptr)noexcept:ptr_t(null_ptr){}
8348 constexpr ptr_t(null_ptr_t)noexcept:ptr_t((T*)(null_ptr)){}
8349 ~ptr_t()noexcept(cut_nothrow){cut_ref();}
8350
8351 static constexpr bool reset_nothrow=cut_nothrow;
8352 void reset(T*a)const noexcept(reset_nothrow){auto tmp=_to;add_ref(_to=a);cut_ref(tmp);}
8353 void reset(nullptr_t=nullptr)const noexcept(reset_nothrow){reset(null_ptr);}
8354 public:
8355 static constexpr bool replace_check_nothrow=(type_info<T>.not_has_attribute(replace_able))||reset_nothrow;
8356 inline void replace_check()const noexcept(replace_check_nothrow){
8357 if constexpr(do_replace_check&&type_info<remove_cvref<T>>.has_attribute(replace_able))
8358 if(attribute_ptr_cast<replace_able>(_to)->replaced())
8359 reset(attribute_ptr_cast<replace_able>(_to)->get_ptr());
8360 }
8361 inline void do_replace(T*p)noexcept(replace_check_nothrow&&reset_nothrow){
8362 if constexpr(type_info<remove_cvref<T>>.has_attribute(replace_able)){
8363 attribute_ptr_cast<replace_able>(_to)->be_replace_as(p);
8364 reset(p);
8365 }
8366 }
8367 template<typename ref_type_,bool do_replace_check_>
8368 inline void do_replace(const ptr_t<T,ref_type_,do_replace_check_>&p)noexcept(replace_check_nothrow&&reset_nothrow){
8369 do_replace(p.get());
8370 }
8371 static constexpr bool get_nothrow=replace_check_nothrow;
8372 [[nodiscard]]T*get()const noexcept(get_nothrow){
8373 replace_check();
8374 return base_t::get();
8375 }
8376 [[nodiscard]]bool unique()const noexcept{return attribute_ptr_cast<ref_able>(get())->link_num()==1;}
8377 [[nodiscard]]constexpr
8379 unstable_hash_t,hash_t> hash()const noexcept_as(elc::defs::hash(get())){//注意:当T可replace时,同一ptr的hash可能变动
8380 using elc::defs::hash;
8381 return hash(get());
8382 }
8383
8384 [[nodiscard]]inline auto operator==(const T*a)const noexcept_as(pointer_equal(add_const(declvalue(const this_t&).get()),a)){
8385 return pointer_equal(add_const(get()),a);
8386 }
8387 [[nodiscard]]inline auto operator==(nullptr_t)const noexcept_as(operator==(null_ptr)){
8388 return operator==(null_ptr);
8389 }
8390 [[nodiscard]]inline auto operator==(null_ptr_t)const noexcept_as(operator==((T*)null_ptr)){
8391 return operator==((T*)null_ptr);
8392 }
8393 template<typename ref_type_,bool do_replace_check_>
8394 [[nodiscard]]inline auto operator==(const ptr_t<T,ref_type_,do_replace_check_>&b)const
8396 declvalue(const this_t&).get(),
8397 b.get())
8398 ){
8399 return pointer_equal(get(),b.get());
8400 }
8401 template<typename ref_type_,bool do_replace_check_> requires(type_info<remove_cv<T>>!=type_info<T>)
8402 [[nodiscard]]inline auto operator==(const ptr_t<const T,ref_type_,do_replace_check_>&b)const
8404 declvalue(const this_t&).get(),
8405 b.get())
8406 ){
8407 return pointer_equal(get(),b.get());
8408 }
8409 template<typename ref_type_,bool do_replace_check_> requires(type_info<remove_cv<T>>!=type_info<T>)
8410 [[nodiscard]]inline auto operator==(const ptr_t<remove_cv<T>,ref_type_,do_replace_check_>&b)const
8412 declvalue(const this_t&).get(),
8413 add_const(b.get()))
8414 ){
8415 return pointer_equal(get(),add_const(b.get()));
8416 }
8417 };
8418
8419 template<typename T_,typename T,typename ref_type,bool do_replace_check,enable_if(type_info<T_>.base_on<T>)>
8420 [[nodiscard]]inline auto operator==(const T_*a,ptr_t<T,ref_type,do_replace_check>&b)noexcept_as(b.operator==(static_cast<const T*>(a))){
8421 return b.operator==(static_cast<const T*>(a));
8422 }
8423
8424 template<typename T,typename T_> requires(equal.able<T,T_>)
8425 [[nodiscard]]inline auto operator!=(T&&a,T_&&b)noexcept_as(!(a==b)){
8426 return !(a==b);
8427 }
8428
8429 template<class T,typename ref_type,bool do_replace_check>
8430 struct base_ptr_t:ptr_t<T,ref_type,do_replace_check>{
8431 static_assert(type_info<T>.base_on<ref_type>);
8434 using typename base_t::same_ref;
8435 using typename base_t::same_ptr;
8436 using base_t::reset;
8437 using base_t::get;
8438 using same_ref::swap_with;
8439 using same_ptr::_to;
8440
8441 using base_t::get_nothrow;
8442 using base_t::reset_nothrow;
8443
8445
8447 base_ptr_t(base_ptr_t&&a)noexcept:base_t(move(a)){}
8448
8449 [[nodiscard]]T*operator->()const noexcept(get_nothrow){return get();}
8450 [[nodiscard]]T&operator*()const noexcept(get_nothrow){return*get();}
8451 [[nodiscard]]explicit operator bool()const noexcept(get_nothrow){return bool(pointer_to_bool(get()));}
8452 [[nodiscard]]auto operator!()const noexcept(get_nothrow){return!pointer_to_bool(get());}
8453 [[nodiscard]]explicit operator T*()const noexcept(get_nothrow){return get();}
8454
8455 base_ptr_t&operator=(T*a)&noexcept(reset_nothrow){reset(a);return*this;}
8456 base_ptr_t&operator=(const same_ptr&a)&noexcept(reset_nothrow&&get_nothrow){reset(a.get());return*this;}
8457 base_ptr_t&operator=(const base_ptr_t&a)&noexcept(reset_nothrow&&get_nothrow){reset(a.get());return*this;}
8458 base_ptr_t&operator=(same_ref&&a)&noexcept{swap_with(a);return*this;}
8459 base_ptr_t&operator=(base_ptr_t&&a)&noexcept{swap_with(a);return*this;}
8460 base_ptr_t&operator=(null_ptr_t)&noexcept(reset_nothrow){return*this=(T*)null_ptr;}
8461 base_ptr_t&operator=(nullptr_t)&noexcept(reset_nothrow){return*this=null_ptr;}
8462
8463 private:
8464 static inline thread_local class for_delete_t{
8465 T*_m;
8466 friend class this_t;
8467 for_delete_t*operator()(T*a)noexcept{
8468 _m=a;
8469 return this;
8470 }
8471 public:
8472 static void operator delete(void*a)noexcept_as(destroy(declvalue(T*))){
8473 destroy(reinterpret_cast<for_delete_t*>(a)->_m);
8474 }
8475 }for_delete{};
8476 public:
8477 [[nodiscard]]explicit operator bool()noexcept(get_nothrow){return add_const(this)->operator bool();}
8478 [[nodiscard]]distinctive operator for_delete_t*()noexcept(get_nothrow){return for_delete(get());}
8479
8480 template<typename...Args> requires(invoke<T>.able<Args...>)
8481 inline auto operator()(Args&&... rest)noexcept(invoke<T>.nothrow<Args...>){return(operator*())(forward<Args>(rest)...);}
8482 };
8483
8484 //file_end
8485
8486 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8487 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/comn_ptr_t.hpp"
8488 //comn_ptr_t.hpp
8489 //at namespace elc::defs::memory::ptr_n
8490 /*
8491 未完成的elc解释器base文件
8492 由steve02081504与Alex0125设计、编写
8493 转载时请在不对此文件做任何修改的同时注明出处
8494 项目地址:https://github.com/steve02081504/ELC
8495 */
8496 template<typename T>
8498
8499 //file_end
8500
8501 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8502 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/weak_ptr_t.hpp"
8503 //weak_ptr_t.hpp
8504 //at namespace elc::defs::memory::ptr_n
8505 /*
8506 未完成的elc解释器base文件
8507 由steve02081504与Alex0125设计、编写
8508 转载时请在不对此文件做任何修改的同时注明出处
8509 项目地址:https://github.com/steve02081504/ELC
8510 */
8511 template<typename T>
8513
8514 //file_end
8515
8516 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8517 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/nocheck_ptr_t.hpp"
8518 //nocheck_ptr_t.hpp
8519 //at namespace elc::defs::memory::ptr_n
8520 /*
8521 未完成的elc解释器base文件
8522 由steve02081504与Alex0125设计、编写
8523 转载时请在不对此文件做任何修改的同时注明出处
8524 项目地址:https://github.com/steve02081504/ELC
8525 */
8526 template<typename T>
8528
8529 //file_end
8530
8531 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8532 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/deduction_guides.hpp"
8533 //deduction_guides.hpp
8534 //at namespace elc::defs::memory::ptr_n
8535 /*
8536 未完成的elc解释器base文件
8537 由steve02081504与Alex0125设计、编写
8538 转载时请在不对此文件做任何修改的同时注明出处
8539 项目地址:https://github.com/steve02081504/ELC
8540 */
8541 template<class T,common_attribute_t ref_type,bool has_check>
8542 base_ptr_t(T*) -> base_ptr_t<remove_cvref<T>,ref_type<remove_cvref<T>>,has_check>;
8543
8544 template<class T,common_attribute_t ref_type,bool has_check>
8546
8547 //file_end
8548
8549 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8550
8551 //file_end
8552
8553 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/defs.hpp"
8554 }
8555
8556 //file_end
8557
8558 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8559 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_export.hpp"
8560 //_export.hpp
8561 //at namespace elc
8562 /*
8563 未完成的elc解释器base文件
8564 由steve02081504与Alex0125设计、编写
8565 转载时请在不对此文件做任何修改的同时注明出处
8566 项目地址:https://github.com/steve02081504/ELC
8567 */
8568 #define export using ptr_n::
8569 export ref_able;
8570 export weak_ref_able;
8571 export base_ptr_t;
8572 export comn_ptr_t;
8573 export weak_ptr_t;
8574 #undef export
8575
8576 //file_end
8577
8578 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8579 #if defined(ELC_TEST_ON)
8580 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_test.hpp"
8581 //_test.hpp
8582 //at namespace elc::defs::memory::ptr_n
8583 /*
8584 未完成的elc解释器base文件
8585 由steve02081504与Alex0125设计、编写
8586 转载时请在不对此文件做任何修改的同时注明出处
8587 项目地址:https://github.com/steve02081504/ELC
8588 */
8589 namespace ptr_n{
8590 struct tester:type_info_t<tester>::template_name
8591 with_common_attribute<ref_able,weak_ref_able,never_in_array>,build_by_get_only{};
8592 void waiting_for_destroy(tester*)noexcept{}
8593 inline void test(){
8594 ELC_TEST_EVENTNAME("ptr部分测试");
8595 {
8596 comn_ptr_t a=get<tester>();
8597 weak_ptr_t b=a;
8598 }
8599 check_memory_lack();
8600 }
8601 inline void test_log_out(){
8602 }
8603 inline void test_end(){
8604 }
8605 }
8606
8607 //file_end
8608
8609 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8610 #endif
8611
8612 //file_end
8613
8614 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8615 //依赖list
8616 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/_body.hpp"
8617 //_body.hpp
8618 //at namespace elc::defs::memory
8619 /*
8620 未完成的elc解释器base文件
8621 由steve02081504与Alex0125设计、编写
8622 转载时请在不对此文件做任何修改的同时注明出处
8623 项目地址:https://github.com/steve02081504/ELC
8624 */
8625 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/replace_able.hpp"
8626 //replace_able.hpp
8627 //at namespace elc::defs::memory
8628 /*
8629 未完成的elc解释器base文件
8630 由steve02081504与Alex0125设计、编写
8631 转载时请在不对此文件做任何修改的同时注明出处
8632 项目地址:https://github.com/steve02081504/ELC
8633 */
8634 //此属性配合 "../ptr" 食用
8635 template<typename T>
8637 private:
8638 mutable T*_m;
8639 public:
8640 constexpr replace_able()noexcept:_m(get_handle(this)){}
8641 constexpr ~replace_able()noexcept{
8642 if(replaced())
8643 attribute_ptr_cast<ref_able>(_m)->cut_ref();
8644 }
8645 constexpr bool replaced()const noexcept{return _m!=get_handle(this);}
8646 constexpr T*get_ptr()const noexcept{
8647 if(!replaced())
8648 return _m;
8649 else
8650 return attribute_ptr_cast<replace_able>(_m)->get_ptr();
8651 }
8652 constexpr void be_replace_as(T*new_p)noexcept{
8653 if(replaced())
8654 attribute_ptr_cast<ref_able>(_m)->cut_ref();
8655 _m=new_p;
8656 if(replaced())
8657 attribute_ptr_cast<ref_able>(_m)->add_ref();
8658 }
8659 constexpr void be_replace_as(nullptr_t)noexcept{be_replace_as(null_ptr);}
8660 };
8661
8662 //file_end
8663
8664 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/_body.hpp"
8665 //依赖list
8666 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/can_map_all.hpp"
8667 //can_map_all.hpp
8668 //at namespace elc::defs::memory
8669 /*
8670 未完成的elc解释器base文件
8671 由steve02081504与Alex0125设计、编写
8672 转载时请在不对此文件做任何修改的同时注明出处
8673 项目地址:https://github.com/steve02081504/ELC
8674 */
8675 template<typename T>
8676 struct can_map_all:cons_t<can_map_all<T>>,is_common_attribute(can_map_all){
8678 private:
8679 distinctive inline static list_t<this_t> type_list;
8680
8681 template<class,class func_t>
8682 friend inline void map_all_helper(func_t&&a);
8683 public:
8684 constexpr can_map_all(){
8685 type_list.add(this);
8686 }
8687 };
8688 template<class T,class func_t>
8689 inline void map_all_helper(func_t&&a){
8690 auto tmp=can_map_all<T>::type_list.begin();
8691 auto end=can_map_all<T>::type_list.end();
8692 while(tmp!=end){
8693 a(get_handle<T,can_map_all>(tmp++));
8694 }
8695 }
8696 #define expr declvalue(func_t)(declvalue(T*))
8697 template<class T,class func_t,enable_if(was_not_an_ill_form(expr))>
8698 inline void map_all(func_t&&a)noexcept_as(expr){
8699 map_all_helper<T,func_t>(forward<func_t>(a));
8700 }
8701 #undef expr
8702
8703 //file_end
8704
8705 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/_body.hpp"
8706
8707 //file_end
8708
8709 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8710
8711 //#include "gc/_body.hpp"//NOTE:gc不在此处定义,因为它依赖container
8712
8713 #if defined(ELC_TEST_ON)
8714 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_test.hpp"
8715 //_test.hpp
8716 //at namespace elc::defs::memory
8717 /*
8718 未完成的elc解释器base文件
8719 由steve02081504与Alex0125设计、编写
8720 转载时请在不对此文件做任何修改的同时注明出处
8721 项目地址:https://github.com/steve02081504/ELC
8722 */
8723 inline void test(){
8724 ELC_TEST_EVENTNAME("memory部分测试");
8725 alloc_n::test();
8726 lifetime_n::test();
8727 get_n::test();
8728 //pool_n::test();
8729 }
8730 inline void test_log_out(){
8731 alloc_n::test_log_out();
8732 lifetime_n::test_log_out();
8733 get_n::test_log_out();
8734 //pool_n::test_log_out();
8735 }
8736 inline void test_end(){
8737 alloc_n::test_end();
8738 lifetime_n::test_end();
8739 get_n::test_end();
8740 //pool_n::test_end();
8741 }
8742
8743 //file_end
8744
8745 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8746 #endif
8747
8748 //file_end
8749
8750 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
8751 }
8752 using namespace memory;
8753
8754 namespace container{
8755 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
8756 //_body.hpp
8757 //at namespace elc::defs::container
8758 /*
8759 未完成的elc解释器base文件
8760 由steve02081504与Alex0125设计、编写
8761 转载时请在不对此文件做任何修改的同时注明出处
8762 项目地址:https://github.com/steve02081504/ELC
8763 */
8764 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
8765 //_body.hpp
8766 //at namespace elc::defs::container
8767 /*
8768 未完成的elc解释器base文件
8769 由steve02081504与Alex0125设计、编写
8770 转载时请在不对此文件做任何修改的同时注明出处
8771 项目地址:https://github.com/steve02081504/ELC
8772 */
8773 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/defs.hpp"
8774 //defs.hpp
8775 //at namespace elc::defs::container
8776 /*
8777 未完成的elc解释器base文件
8778 由steve02081504与Alex0125设计、编写
8779 转载时请在不对此文件做任何修改的同时注明出处
8780 项目地址:https://github.com/steve02081504/ELC
8781 */
8782 namespace array_n{
8783 template<typename T>
8784 class array_t{
8785 typedef array_t<T>this_t;
8786 T*_m;
8787 #if defined(DEBUG) || defined(_DEBUG)
8788 size_t _size_for_debug_view=0;
8789 #endif
8790
8791 #if defined(DEBUG) || defined(_DEBUG)
8792 /*return{ptr,size};*/
8793 constexpr array_t(T*a,size_t s):_m(a),_size_for_debug_view(s){}
8794 #else
8795 /*return{ptr};*/
8796 constexpr array_t(T*a):_m(a){}
8797 #endif
8798 /*返回一个自身的副本*/
8799 [[nodiscard]]this_t copy()const noexcept(copy_get.nothrow<T>) requires(copy_get.able<T>){
8800 #if defined(DEBUG) || defined(_DEBUG)
8801 return{copy_get(_m),_size_for_debug_view};
8802 #else
8803 return{copy_get(_m)};
8804 #endif
8805 }
8806 public:
8807 void swap_with(this_t&a)noexcept{
8808 swap(_m,a._m);
8809 #if defined(DEBUG) || defined(_DEBUG)
8810 swap(_size_for_debug_view,a._size_for_debug_view);
8811 #endif
8812 }
8813 public:
8814 /*默认构造*/
8815 constexpr array_t()noexcept:_m(null_ptr){}
8816 /*
8817 构造size个T
8818 */
8819 explicit array_t(note::size_t<size_t>size)noexcept(get<T>.nothrow<>){
8820 _m=get<T>[size.value]();
8821 #if defined(DEBUG) || defined(_DEBUG)
8822 _size_for_debug_view=size.value;
8823 #endif
8824 }
8825 explicit array_t(note::size_t<size_t>size,const T&elem)noexcept(get<T>.nothrow<>){
8826 _m=get<T>[size.value](elem);
8827 #if defined(DEBUG) || defined(_DEBUG)
8828 _size_for_debug_view=size.value;
8829 #endif
8830 }
8831 /*
8832 此重载适用于T[N],std::init_list<T>以及range_t<const T*>
8833 */
8834 //template<as_concept<get<T>.as_array.able> U>
8835 template<class U> requires(get<T>.as_array.able<U>)
8836 array_t(U&&a)noexcept(get<T>.as_array.nothrow<U>){
8837 _m=get<T>.as_array(forward<U>(a));
8838 #if defined(DEBUG) || defined(_DEBUG)
8839 _size_for_debug_view=size();
8840 #endif
8841 }
8842
8843 //复制和移动函数
8844 array_t(const this_t&a)noexcept_as(declvalue(this_t).copy()):array_t(a.copy()){}
8846 return operator=(a.copy());
8847 }
8848 array_t(this_t&&a)noexcept:array_t(){swap_with(a);}
8850 swap_with(a);
8851 return*this;
8852 }
8853
8854 ~array_t()noexcept(unget.nothrow<T>){
8855 unget(_m);
8856 }
8857 [[nodiscard]]size_t size()const noexcept{
8858 return get_size_of_get(_m);
8859 }
8860 [[nodiscard]]size_t size_in_byte()const noexcept{
8861 return size()*sizeof(T);
8862 }
8863 static constexpr bool resize_nothrow = get_resize.nothrow<T>;
8864 void resize(size_t size)noexcept(resize_nothrow){
8865 get_resize(_m,size);
8866 #if defined(DEBUG) || defined(_DEBUG)
8867 _size_for_debug_view=size;
8868 #endif
8869 }
8870 static constexpr bool forward_resize_nothrow = get_forward_resize.nothrow<T>;
8871 void forward_resize(size_t size)noexcept(forward_resize_nothrow){
8872 get_forward_resize(_m,size);
8873 #if defined(DEBUG) || defined(_DEBUG)
8874 _size_for_debug_view=size;
8875 #endif
8876 }
8877 static constexpr bool insert_nothrow = get_resize.insert.nothrow<T>;
8878 void insert(size_t index,size_t count)noexcept(insert_nothrow){
8879 get_resize.insert(_m,index,count);
8880 #if defined(DEBUG) || defined(_DEBUG)
8881 _size_for_debug_view+=count;
8882 #endif
8883 }
8884 void insert(size_t index,size_t count,const T*data)noexcept(insert_nothrow){
8885 get_resize.insert(_m,index,count,data);
8886 #if defined(DEBUG) || defined(_DEBUG)
8887 _size_for_debug_view+=count;
8888 #endif
8889 }
8890 void insert_with_resize(size_t index,size_t count,const T*data,size_t new_size)noexcept(insert_nothrow){
8891 get_resize.insert_with_resize(_m,index,count,data,new_size);
8892 #if defined(DEBUG) || defined(_DEBUG)
8893 _size_for_debug_view=new_size;
8894 #endif
8895 }
8896 static constexpr bool insert_with_forward_resize_nothrow = get_forward_resize.insert_with_resize.nothrow<T>;
8897 void insert_with_forward_resize(size_t index,size_t count,const T*data,size_t new_size)noexcept(insert_with_forward_resize_nothrow){
8898 get_forward_resize.insert_with_resize(_m,index,count,data,new_size);
8899 #if defined(DEBUG) || defined(_DEBUG)
8900 _size_for_debug_view=new_size;
8901 #endif
8902 }
8903 [[nodiscard]]bool empty()const{
8904 return _m==null_ptr;
8905 }
8906 void clear()noexcept(re_construct.nothrow<this_t>){
8907 re_construct(this);
8908 }
8909 [[nodiscard]]T&operator[](size_t pos)noexcept{return _m[pos];}
8910 [[nodiscard]]const T&operator[](size_t pos)const noexcept{return _m[pos];}
8911 [[nodiscard]]explicit operator hash_t()const noexcept(hash.nothrow<T>){return hash(_m,size());}
8912 [[nodiscard]]explicit operator T*()noexcept{return _m;}
8913 [[nodiscard]]explicit operator const T*()const noexcept{return _m;}
8914
8915 typedef iterator_t<T>iterator;
8916 typedef const_iterator_t<T>const_iterator;
8917
8918 [[nodiscard]]constexpr iterator get_iterator_at(size_t a)noexcept{
8919 return _m+a;
8920 }
8921 [[nodiscard]]constexpr const_iterator get_iterator_at(size_t a)const noexcept{
8922 return _m+a;
8923 }
8924 [[nodiscard]]constexpr iterator begin()noexcept{
8925 return get_iterator_at(zero);
8926 }
8927 [[nodiscard]]iterator end()noexcept{
8928 return get_iterator_at(size());
8929 }
8930 [[nodiscard]]constexpr const_iterator begin()const noexcept{
8931 return get_iterator_at(zero);
8932 }
8933 [[nodiscard]]const_iterator end()const noexcept{
8934 return get_iterator_at(size());
8935 }
8936 [[nodiscard]]const_iterator cbegin()const noexcept{
8937 return begin();
8938 }
8939 [[nodiscard]]const_iterator cend()const noexcept{
8940 return end();
8941 }
8942
8943 [[nodiscard]]constexpr auto operator<=>(array_like_view_t<const T> a)const noexcept(compare.nothrow<array_like_view_t<T>>){
8944 return compare(array_like_view_t<const T>(*this),a);
8945 }
8946 [[nodiscard]]constexpr auto operator==(array_like_view_t<const T> a)const noexcept(equal.nothrow<array_like_view_t<T>>){
8947 return equal(array_like_view_t<const T>(*this),a);
8948 }
8949 [[nodiscard]]constexpr auto operator<=>(const this_t&a)const noexcept(compare.nothrow<array_like_view_t<T>>){
8950 return operator<=>(array_like_view_t<const T>(a));
8951 }
8952 [[nodiscard]]constexpr auto operator==(const this_t&a)const noexcept(equal.nothrow<array_like_view_t<T>>){
8954 }
8955
8956 #define expr declvalue(func_t)(declvalue(T&))
8957 template<typename func_t> requires was_not_an_ill_form(expr)
8958 void for_each(func_t&&func)noexcept_as(expr){
8959 auto asize=size();
8960 while(asize--)
8961 func((*this)[asize]);
8962 }
8963 #undef expr
8964
8965 #define expr declvalue(func_t)(declvalue(const T&))
8966 template<typename func_t> requires was_not_an_ill_form(expr)
8967 void for_each(func_t&&func)const noexcept_as(expr){
8968 auto asize=size();
8969 while(asize--)
8970 func((*this)[asize]);
8971 }
8972 #undef expr
8973
8974 void push_back(const T&a){
8975 get<T>.apply_end(note::to<T*&>(_m),a);
8976 #if defined(DEBUG) || defined(_DEBUG)
8977 _size_for_debug_view=size();
8978 #endif
8979 }
8980 void push_back(T&&a){
8981 get<T>.apply_end(note::to<T*&>(_m),move(a));
8982 #if defined(DEBUG) || defined(_DEBUG)
8983 _size_for_debug_view=size();
8984 #endif
8985 }
8986 void remove(T a){
8987 get<T>.remove(a,note::from(_m));
8988 #if defined(DEBUG) || defined(_DEBUG)
8989 _size_for_debug_view=size();
8990 #endif
8991 }
8992 //template<as_concept<get<T>.apply_end.able> U>
8993 template<class U,enable_if(get<T>.apply_end.able)>
8994 friend this_t&operator+=(this_t&a,U&&b)noexcept(get<T>.apply_end.nothrow<U>){
8995 get<T>.apply_end(note::to(a._m),b);
8996 return a;
8997 }
8998 friend this_t&operator+=(this_t&a,zero_t b)noexcept(get<T>.apply_end.nothrow<T>){
8999 return a+=T(0);
9000 }
9001 template<typename U>
9002 friend this_t operator+(const this_t&a,U&&b)noexcept_as(a.copy()+=b) requires was_not_an_ill_form(a.copy()+=b){
9003 return a.copy()+=b;
9004 }
9005 template<typename U>
9006 friend this_t operator+(U&&a,const this_t&b)noexcept_as(this_t(a)+=b) requires was_not_an_ill_form(this_t(a)+=b){
9007 return this_t(a)+=b;
9008 }
9009
9010 template<typename U>
9011 this_t&& operator+(U&& b)&&noexcept_as(*this+=b) requires was_not_an_ill_form(*this+=b){//对右值的operator+优化为operator+=
9012 return *this+=b;
9013 }
9014
9015
9016 template<typename U>
9017 [[nodiscard]]iterator find(U&&a)noexcept requires was_not_an_ill_form(in_range(declvalue(this_t),a)){
9018 return in_range(*this,a);
9019 }
9020 template<typename U>
9021 [[nodiscard]]const_iterator find(U&&a)const noexcept requires was_not_an_ill_form(in_range(declvalue(this_t),a)){
9022 return in_range(*this,a);
9023 }
9024 };
9025 template<typename T>
9026 inline void swap(array_t<T>&a,array_t<T>&b)noexcept{a.swap_with(b);}
9027
9028 template<class T>
9029 [[nodiscard]]inline auto size_of_array_like(const array_t<remove_cv<T>>&a)noexcept{return a.size();}
9030 template<class T>
9031 [[nodiscard]]inline auto begin_of_array_like(array_t<remove_cv<T>>&a)noexcept{return(T*)a.begin();}
9032 template<class T>
9033 [[nodiscard]]inline auto begin_of_array_like(const array_t<remove_cv<T>>&a)noexcept{return(const T*)a.begin();}
9034 }
9035
9036 //file_end
9037
9038 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9039 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/deduction_guides.hpp"
9040 //deduction_guides.hpp
9041 //at namespace elc::defs::container
9042 /*
9043 未完成的elc解释器base文件
9044 由steve02081504与Alex0125设计、编写
9045 转载时请在不对此文件做任何修改的同时注明出处
9046 项目地址:https://github.com/steve02081504/ELC
9047 */
9048 namespace array_n{
9049 template <class T,class...U>
9051 template <class T>
9053 }
9054
9055 //file_end
9056
9057 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9058 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_export.hpp"
9059 //_export.hpp
9060 //at namespace elc::defs::container
9061 /*
9062 未完成的elc解释器base文件
9063 由steve02081504与Alex0125设计、编写
9064 转载时请在不对此文件做任何修改的同时注明出处
9065 项目地址:https://github.com/steve02081504/ELC
9066 */
9067 #define export using array_n::
9068 export array_t;
9069 #undef export
9070
9071 //file_end
9072
9073 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9074 #if defined(ELC_TEST_ON)
9075 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_test.hpp"
9076 //_test.hpp
9077 //at namespace elc::defs::container
9078 /*
9079 未完成的elc解释器base文件
9080 由steve02081504与Alex0125设计、编写
9081 转载时请在不对此文件做任何修改的同时注明出处
9082 项目地址:https://github.com/steve02081504/ELC
9083 */
9084 namespace array_n{
9085 //BLOCK:for debug
9086 inline void test(){
9087 ELC_TEST_EVENTNAME("array部分测试");
9088 {
9089 array_t<int>anarray;
9090 stest_accert(anarray.size()==0);
9091 anarray.resize(5);
9092 stest_accert(anarray.size()==5);
9093 anarray[2]=99;
9094 stest_accert(anarray[2]==99);
9095 anarray.resize(3);
9096 stest_accert(anarray[2]==99);
9097 anarray=anarray;
9098 swap(anarray,anarray);
9099 }
9100 check_memory_lack();
9101 }
9102 inline void test_log_out(){
9103 }
9104 inline void test_end(){
9105 }
9106 //BLOCK_END
9107 }
9108
9109 //file_end
9110
9111 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9112 #endif
9113
9114 //file_end
9115
9116 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
9117 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9118 //_body.hpp
9119 //at namespace elc::defs::container
9120 /*
9121 未完成的elc解释器base文件
9122 由steve02081504与Alex0125设计、编写
9123 转载时请在不对此文件做任何修改的同时注明出处
9124 项目地址:https://github.com/steve02081504/ELC
9125 */
9126 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/base_function_t.hpp"
9127 //base_function_t.hpp
9128 //at namespace elc::defs::container
9129 /*
9130 未完成的elc解释器base文件
9131 由steve02081504与Alex0125设计、编写
9132 转载时请在不对此文件做任何修改的同时注明出处
9133 项目地址:https://github.com/steve02081504/ELC
9134 */
9135 namespace function_n{
9136 template<class T>
9138 template<class Ret_t,class...Args_t>
9139 no_vtable_struct base_func_data_t<Ret_t(Args_t...)>:type_info_t<base_func_data_t<Ret_t(Args_t...)>>::template_name with_common_attribute<abstract_base,ref_able,never_in_array>,build_by_get_only{
9140 typedef base_func_data_t<Ret_t(Args_t...)>this_t;
9141 typedef comn_ptr_t<this_t>ptr_t;
9142
9143 virtual ~base_func_data_t()=default;
9144 virtual Ret_t call(Args_t...)=0;
9145 //for equal:
9146 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept=0;
9147 [[nodiscard]]virtual const void*get_data_begin()const noexcept=0;
9148 [[nodiscard]]virtual bool equal_with(const void*)const=0;
9149 [[noreturn]] virtual void throw_self_ptr()const=0;
9150 [[noreturn]] virtual void throw_self_ptr()=0;
9151 [[nodiscard]]bool operator==(const this_t&a)const{
9152 return this->get_type_info()==a.get_type_info()&&this->equal_with(a.get_data_begin());
9153 }
9154 template<typename T>
9155 [[nodiscard]]bool operator==(const T&a)const{
9156 return this->get_type_info()==type_info<T>&&this->equal_with(addressof(a));
9157 }
9158 typedef Ret_t(*func_ptr_t)(Args_t...);
9159 virtual func_ptr_t get_func_ptr()const noexcept{return nullptr;}
9160 };
9161
9162 template<class T,class Func_t>
9164 template<class T,class Ret_t,class...Args_t>
9165 struct func_data_t<T,Ret_t(Args_t...)>final:
9166 type_info_t<func_data_t<T,Ret_t(Args_t...)>>::template_name with_common_attribute<instance_struct>,
9167 base_func_data_t<Ret_t(Args_t...)>,function_data_warpper_t<T,Ret_t(Args_t...)>{
9168 static_assert(!::std::is_function_v<T>);
9169 typedef base_func_data_t<Ret_t(Args_t...)>base_t;
9170 typedef func_data_t<T,Ret_t(Args_t...)>this_t;
9171 typedef function_data_warpper_t<T,Ret_t(Args_t...)>data_t;
9173 typedef base_t::func_ptr_t func_ptr_t;
9174
9175 [[nodiscard]]bool is_unique()const noexcept{return get_ref_num((base_t*)this)==1;}
9176
9177 using data_t::data_t;
9178 virtual ~func_data_t()override=default;
9179 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<T>;}
9180 [[nodiscard]]virtual const void*get_data_begin()const noexcept override final{return addressof(data_t::get_data());}
9181 [[noreturn]] virtual void throw_self_ptr()const override final{throw addressof(data_t::get_data());}
9182 [[noreturn]] virtual void throw_self_ptr()override final{throw addressof(data_t::get_data());}
9183 [[nodiscard]]virtual bool equal_with(const void*a)const noexcept(equal.able<T>?equal.nothrow<T>:true)override final{
9184 if constexpr(equal.able<T>)
9185 return data_t::get_data()==*remove_const(reinterpret_cast<const T*>(a));
9186 else
9187 return false;
9188 }
9189 [[nodiscard]]virtual Ret_t call(Args_t...args)noexcept(invoke<T>.nothrow<Args_t...>)override final{
9190 return data_t::operator()(forward<Args_t>(args)...);
9191 }
9192
9193 //func ptr convert
9194 virtual func_ptr_t get_func_ptr()const noexcept override final{
9195 if constexpr(type_info<const T>.can_convert_to<func_ptr_t>)
9196 return static_cast<func_ptr_t>(data_t::get_data());
9197 else
9198 return nullptr;
9199 }
9200 };
9201
9202 template<class T>
9204 template<class Ret_t,class...Args_t>
9205 struct default_func_data_t<Ret_t(Args_t...)>final:base_func_data_t<Ret_t(Args_t...)>,instance_struct<default_func_data_t<Ret_t(Args_t...)>>{
9206 typedef base_func_data_t<Ret_t(Args_t...)>base_t;
9208
9209 virtual ~default_func_data_t()noexcept override final{}
9210 virtual Ret_t call(Args_t...)noexcept_as(Ret_t())override final{return Ret_t();}
9211 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<void>;}
9212 [[nodiscard]]virtual const void*get_data_begin()const noexcept override final{return null_ptr;}//这玩意实际上用不到,艹
9213 [[noreturn]] virtual void throw_self_ptr()const override final{throw(const void*)null_ptr;}
9214 [[noreturn]] virtual void throw_self_ptr()override final{throw(void*)null_ptr;}
9215 [[nodiscard]]virtual bool equal_with(const void*)const noexcept override final{return true;}
9216 };
9217 template<class Ret_t,class...Args_t>
9219
9220 template<class Ret_t,class...Args_t>
9221 [[nodiscard]]constexpr base_func_data_t<Ret_t(Args_t...)>*the_get_null_ptr(const base_func_data_t<Ret_t(Args_t...)>*)noexcept{
9222 return&default_func_data<Ret_t,Args_t...>;
9223 }
9224
9225 template<class T>
9227 template<class Ret_t,class...Args_t>
9228 class function_data_saver_t<Ret_t(Args_t...)>{
9229 protected:
9230 typedef function_data_saver_t<Ret_t(Args_t...)>this_t;
9231 typedef base_func_data_t<Ret_t(Args_t...)> base_t_w;
9232 typedef comn_ptr_t<base_t_w>ptr_t;
9233
9234 mutable ptr_t _m;
9235 void swap_with(this_t&a)noexcept{swap(_m,a._m);}
9236 public:
9237 function_data_saver_t()noexcept=default;
9238 function_data_saver_t(const this_t&a)noexcept:_m(a._m){}
9239 function_data_saver_t(this_t&&a)noexcept{swap_with(a);}
9240 [[nodiscard]]bool operator==(const this_t&a)const{
9241 return *_m==*(a._m);
9242 }
9243 template<typename T> requires(equal.able<base_t_w,T>)
9244 [[nodiscard]]bool operator==(T&&a)const noexcept(equal.nothrow<base_t_w,T>){
9245 return *_m==a;
9246 }
9247 template<typename T>
9248 [[nodiscard]]bool was_an()const noexcept{
9249 try{
9250 _m->throw_self_ptr();
9251 }
9252 catch(const T*p){
9253 return true;
9254 }
9255 catch(const void*){}
9256 return false;
9257 }
9258 template<typename T>
9259 [[nodiscard]]maybe_fail_reference<T> get_as()noexcept{
9260 try{
9261 _m->throw_self_ptr();
9262 }
9263 catch(T*p){
9264 return *p;
9265 }
9266 catch(void*){}
9267 return note::fail;
9268 }
9269 suppress_msvc_warning(26440)//nothrow警告diss
9270 void operator=(const this_t&a){_m=a._m;}
9271 Ret_t call(Args_t&&...rest)const{return _m->call(forward<Args_t>(rest)...);}
9272 };
9273
9274 #if !defined(_MSC_VER)
9275 template<class T,bool promise_nothrow_at_destruct>
9277 template<class Ret_t,class...Args_t,bool nothrow,bool promise_nothrow_at_destruct>
9278 struct base_function_t<Ret_t(Args_t...)noexcept(nothrow),promise_nothrow_at_destruct>:function_data_saver_t<Ret_t(Args_t...)>{
9279 protected:
9280 typedef function_data_saver_t<Ret_t(Args_t...)>base_t;
9281 typedef base_function_t<Ret_t(Args_t...)noexcept(nothrow),promise_nothrow_at_destruct>this_t;
9282
9283 template<class,bool>
9284 friend class base_function_t;
9285
9286 template<class U>
9287 using func_data_t=function_n::func_data_t<U,Ret_t(Args_t...)>;
9288
9289 typedef Ret_t(*func_ptr_t)(Args_t...)noexcept(nothrow);
9290
9291 using base_t::ptr_t;
9292 using base_t::_m;
9293
9294 template<class T>
9295 static constexpr bool base_on_this_t_or_more_stringent_restrictions=(
9296 type_info<T>.base_on<this_t>||
9297 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept(bool(nothrow+1)), promise_nothrow_at_destruct >>||
9298 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept(nothrow), bool(promise_nothrow_at_destruct+1) >>||
9299 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept(bool(nothrow+1)), bool(promise_nothrow_at_destruct+1) >>
9300 );
9301
9302 template<class T>
9303 static constexpr bool get_data_able=invoke<T>.able<Args_t...> && not base_on_this_t_or_more_stringent_restrictions<T>;
9304 template<class T>
9305 static constexpr bool get_data_nothrow=get<func_data_t<remove_cvref<T>>>.nothrow<T>;
9306
9307 template<class T> requires(get_data_able<T> && get<func_data_t<remove_cvref<T>>>.able<T>)
9308 static ptr_t get_data_from(T&&a)noexcept(get_data_nothrow<T>){
9309 //BLOCK:constexpr checks
9310 if constexpr(promise_nothrow_at_destruct and not destruct.nothrow<T>)
9311 template_error("unexpected assign.");
9312 if constexpr(nothrow)
9313 if constexpr(!invoke<T>.nothrow<Args_t...>)
9314 template_warning("the call of T was not noexcept,this may cause terminate.");
9315 //BLOCK_END
9316 return get<func_data_t<remove_cvref<T>>>(a);
9317 }
9318 explicit base_function_t(base_t::ptr_t a)noexcept{_m=a;}
9319 public:
9320 void swap_with(this_t&a)noexcept{//不与base_t::swap_with重复:与更加严格(或宽松)的this_t进行swap是错误的
9321 base_t::swap_with(a);
9322 }
9323
9324 base_function_t()noexcept=default;
9325 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9326 base_function_t(const T&a)noexcept:base_t(a){}
9327 base_function_t(const this_t&a)noexcept:base_t(a){}
9329 swap_with(a);
9330 }
9333 template<class T> requires(get_data_able<T>)
9334 base_function_t(T&&a)noexcept(get_data_nothrow<T>){
9335 _m=get_data_from(forward<T>(a));
9336 }
9337 base_function_t(func_ptr_t a)noexcept{//当nothrow==0时,noexcept(true)的参数可自动转为noexcept(false)的,不用再次考虑
9338 _m=get<func_data_t<func_ptr_t>>(a);
9339 }
9340 ~base_function_t()noexcept(promise_nothrow_at_destruct)=default;
9341
9342 this_t&operator=(const this_t&a)&noexcept(promise_nothrow_at_destruct)=default;
9343 this_t&operator=(this_t&&a)&noexcept(promise_nothrow_at_destruct)=default;
9344 this_t&operator=(null_ptr_t)&noexcept(promise_nothrow_at_destruct){_m=null_ptr;return *this;}
9345 this_t&operator=(nullptr_t)&noexcept(promise_nothrow_at_destruct){return *this=null_ptr;}
9346 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9347 this_t&operator=(const T&a)&noexcept(promise_nothrow_at_destruct){
9348 base_t::operator=(a);
9349 return*this;
9350 }
9351 template<class T> requires(get_data_able<T>)
9352 this_t&operator=(T&&a)noexcept(get_data_nothrow<T> && promise_nothrow_at_destruct){
9353 _m=get_data_from(forward<T>(a));
9354 return*this;
9355 }
9356
9357 this_t deep_copy(){return this_t{copy_get(_m.get())};}
9358
9359 [[nodiscard]]explicit operator bool()const noexcept{
9360 return bool(_m);
9361 }
9362
9363 Ret_t operator()(Args_t...args)const noexcept(nothrow){
9365 return base_t::call(forward<Args_t>(args)...);
9366 }
9367
9368 private:
9369 //以下是突然想加的功能(没什么用<迷惑行为大赏>).
9370 static thread_local inline base_t::base_t_w* _func_ptr_data_local=nullptr;
9371 static inline ::std::atomic<decltype(_func_ptr_data_local)> _func_ptr_data_gobal=nullptr;
9372 static Ret_t _func_ptr_value(Args_t...args)noexcept{
9373 if(!_func_ptr_data_local)
9374 _func_ptr_data_local=_func_ptr_data_gobal.load(::std::memory_order_relaxed);
9375 return _func_ptr_data_local->call(forward<Args_t>(args)...);
9376 }
9377 public:
9378 //自当前function对象生成一个函数指针,具有与当前function对象相同的行为
9379 //注意:该函数指针的有效性保留到当前线程下一个同类型的函数指针生成时或当前function对象析构时
9380 //若自该函数指针创建一个新的线程,该函数指针在新线程中的行为与调用时以前所有线程中最后一个生成的同类型的函数指针行为相同
9381 [[nodiscard]]explicit operator func_ptr_t()const noexcept(promise_nothrow_at_destruct){
9382 func_ptr_t a=(func_ptr_t)_m->get_func_ptr();
9383 if(a)return a;
9384 _func_ptr_data_local=base_t::_m.get();
9385 _func_ptr_data_gobal.store(_func_ptr_data_local,::std::memory_order_relaxed);
9386 return _func_ptr_value;
9387 }
9388 };
9389 #else
9390 //MSVC,我滴垃圾堆
9391 template<class T,bool promise_nothrow_at_destruct>
9392 class base_function_t;
9393 template<class Ret_t,class...Args_t,bool promise_nothrow_at_destruct>
9394 struct base_function_t<Ret_t(Args_t...),promise_nothrow_at_destruct>:function_data_saver_t<Ret_t(Args_t...)>{
9395 protected:
9396 typedef function_data_saver_t<Ret_t(Args_t...)>base_t;
9397 typedef base_function_t<Ret_t(Args_t...),promise_nothrow_at_destruct>this_t;
9398
9399 template<class,bool>
9400 friend class base_function_t;
9401
9402 template<class U>
9403 using func_data_t=function_n::func_data_t<U,Ret_t(Args_t...)>;
9404
9405 typedef Ret_t(*func_ptr_t)(Args_t...);
9406
9407 using base_t::ptr_t;
9408 using base_t::_m;
9409
9410 template<class T>
9411 static constexpr bool base_on_this_t_or_more_stringent_restrictions=(
9412 type_info<T>.base_on<this_t>||
9413 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, promise_nothrow_at_destruct >>||
9414 type_info<T>.base_on<base_function_t<Ret_t(Args_t...), bool(promise_nothrow_at_destruct+1) >>||
9415 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, bool(promise_nothrow_at_destruct+1) >>
9416 );
9417
9418 template<class T>
9419 static constexpr bool get_data_able=invoke<T>.able<Args_t...> && not base_on_this_t_or_more_stringent_restrictions<T>;
9420 template<class T>
9421 static constexpr bool get_data_nothrow=get<func_data_t<remove_cvref<T>>>.nothrow<T>;
9422
9423 template<class T> requires(get_data_able<T> && get<func_data_t<remove_cvref<T>>>.able<T>)
9424 static auto get_data_from(T&&a)noexcept(get_data_nothrow<T>){
9425 //BLOCK:constexpr checks
9426 if constexpr(promise_nothrow_at_destruct and not destruct.nothrow<T>)
9427 template_error("unexpected assign.");
9428 //BLOCK_END
9429 return get<func_data_t<remove_cvref<T>>>(a);
9430 }
9431 explicit base_function_t(base_t::ptr_t a)noexcept{_m=a;}
9432 public:
9433 void swap_with(this_t&a)noexcept{//不与base_t::swap_with重复:与更加严格(或宽松)的this_t进行swap是错误的
9434 base_t::swap_with(a);
9435 }
9436
9437 base_function_t()noexcept=default;
9438 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9439 base_function_t(const T&a)noexcept:base_t(a){}
9440 base_function_t(const this_t&a)noexcept:base_t(a){}
9441 base_function_t(this_t&&a)noexcept:base_function_t(){
9442 swap_with(a);
9443 }
9444 base_function_t(null_ptr_t)noexcept:base_function_t(){}
9445 base_function_t(nullptr_t)noexcept:base_function_t(null_ptr){}
9446 template<class T> requires(get_data_able<T>)
9447 base_function_t(T&&a)noexcept(get_data_nothrow<T>){
9448 _m=get_data_from(forward<T>(a));
9449 }
9450 base_function_t(func_ptr_t a)noexcept{//当nothrow==0时,noexcept(true)的参数可自动转为noexcept(false)的,不用再次考虑
9451 _m=get<func_data_t<func_ptr_t>>(a);
9452 }
9453 ~base_function_t()noexcept(promise_nothrow_at_destruct)=default;
9454
9455 this_t&operator=(const this_t&a)noexcept(promise_nothrow_at_destruct)=default;
9456 this_t&operator=(this_t&&a)noexcept(promise_nothrow_at_destruct)=default;
9457 this_t&operator=(null_ptr_t)noexcept(promise_nothrow_at_destruct){_m=null_ptr;return *this;}
9458 this_t&operator=(nullptr_t)noexcept(promise_nothrow_at_destruct){return *this=null_ptr;}
9459 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9460 this_t&operator=(const T&a)&noexcept(promise_nothrow_at_destruct){
9461 base_t::operator=(a);
9462 return*this;
9463 }
9464 template<class T> requires(get_data_able<T>)
9465 this_t&operator=(T&&a)noexcept(get_data_nothrow<T> && promise_nothrow_at_destruct){
9466 _m=get_data_from(forward<T>(a));
9467 return*this;
9468 }
9469
9470 this_t deep_copy(){return this_t{copy_get(_m.get())};}
9471
9472 [[nodiscard]]explicit operator bool()const noexcept{
9473 return bool(_m);
9474 }
9475
9476 Ret_t operator()(Args_t...args){
9477 return base_t::call(forward<Args_t>(args)...);
9478 }
9479 Ret_t operator()(Args_t...args)const{
9480 return base_t::call(forward<Args_t>(args)...);
9481 }
9482
9483 private:
9484 //以下是突然想加的功能(没什么用<迷惑行为大赏>).
9485 static thread_local inline base_t::base_t_w* _func_ptr_data_local=nullptr;
9486 static inline ::std::atomic<decltype(_func_ptr_data_local)> _func_ptr_data_gobal=nullptr;
9487 static Ret_t _func_ptr_value(Args_t...args)noexcept{
9488 if(!_func_ptr_data_local)
9489 _func_ptr_data_local=_func_ptr_data_gobal.load(::std::memory_order_relaxed);
9490 return _func_ptr_data_local->call(forward<Args_t>(args)...);
9491 }
9492 public:
9493 //自当前function对象生成一个函数指针,具有与当前function对象相同的行为
9494 //注意:该函数指针的有效性保留到当前线程下一个同类型的函数指针生成时或当前function对象析构时
9495 //若自该函数指针创建一个新的线程,该函数指针在新线程中的行为与调用时以前所有线程中最后一个生成的同类型的函数指针行为相同
9496 [[nodiscard]]explicit operator func_ptr_t()const noexcept(promise_nothrow_at_destruct){
9497 func_ptr_t a=(func_ptr_t)_m->get_func_ptr();
9498 if(a)return a;
9499 _func_ptr_data_local=base_t::_m.get();
9500 _func_ptr_data_gobal.store(_func_ptr_data_local,::std::memory_order_relaxed);
9501 return _func_ptr_value;
9502 }
9503 };
9504 template<class Ret_t,class...Args_t,bool promise_nothrow_at_destruct>
9505 struct base_function_t<Ret_t(Args_t...)noexcept,promise_nothrow_at_destruct>:function_data_saver_t<Ret_t(Args_t...)>{
9506 protected:
9507 typedef function_data_saver_t<Ret_t(Args_t...)>base_t;
9508 typedef base_function_t<Ret_t(Args_t...)noexcept,promise_nothrow_at_destruct>this_t;
9509
9510 template<class,bool>
9511 friend class base_function_t;
9512
9513 template<class U>
9514 using func_data_t=function_n::func_data_t<U,Ret_t(Args_t...)>;
9515
9516 typedef Ret_t(*func_ptr_t)(Args_t...)noexcept;
9517
9518 using base_t::ptr_t;
9519 using base_t::_m;
9520
9521 template<class T>
9522 static constexpr bool base_on_this_t_or_more_stringent_restrictions=(
9523 type_info<T>.base_on<this_t>||
9524 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, promise_nothrow_at_destruct >>||
9525 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, bool(promise_nothrow_at_destruct+1) >>
9526 );
9527
9528 template<class T>
9529 static constexpr bool get_data_able=invoke<T>.able<Args_t...> && not base_on_this_t_or_more_stringent_restrictions<T>;
9530 template<class T>
9531 static constexpr bool get_data_nothrow=get<func_data_t<remove_cvref<T>>>.nothrow<T>;
9532
9533 template<class T> requires(get_data_able<T> && get<func_data_t<remove_cvref<T>>>.able<T>)
9534 static auto get_data_from(T&&a)noexcept(get_data_nothrow<T>){
9535 //BLOCK:constexpr checks
9536 if constexpr(promise_nothrow_at_destruct and not destruct.nothrow<T>)
9537 template_error("unexpected assign.");
9538 if constexpr(1)
9539 if constexpr(!invoke<T>.nothrow<Args_t...>)
9540 template_warning("the call of T was not noexcept,this may cause terminate.");
9541 //BLOCK_END
9542 return get<func_data_t<remove_cvref<T>>>(a);
9543 }
9544 explicit base_function_t(base_t::ptr_t a)noexcept{_m=a;}
9545 public:
9546 void swap_with(this_t&a)noexcept{//不与base_t::swap_with重复:与更加严格(或宽松)的this_t进行swap是错误的
9547 base_t::swap_with(a);
9548 }
9549
9550 base_function_t()noexcept=default;
9551 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9552 base_function_t(const T&a)noexcept:base_t(a){}
9553 base_function_t(const this_t&a)noexcept:base_t(a){}
9554 base_function_t(this_t&&a)noexcept:base_function_t(){
9555 swap_with(a);
9556 }
9557 base_function_t(null_ptr_t)noexcept:base_function_t(){}
9558 base_function_t(nullptr_t)noexcept:base_function_t(null_ptr){}
9559 template<class T> requires(get_data_able<T>)
9560 base_function_t(T&&a)noexcept(get_data_nothrow<T>){
9561 _m=get_data_from(forward<T>(a));
9562 }
9563 base_function_t(func_ptr_t a)noexcept{//当nothrow==0时,noexcept(true)的参数可自动转为noexcept(false)的,不用再次考虑
9564 _m=get<func_data_t<func_ptr_t>>(a);
9565 }
9566 ~base_function_t()noexcept(promise_nothrow_at_destruct)=default;
9567
9568 this_t&operator=(const this_t&a)&noexcept(promise_nothrow_at_destruct)=default;
9569 this_t&operator=(this_t&&a)&noexcept(promise_nothrow_at_destruct)=default;
9570 this_t&operator=(null_ptr_t)&noexcept(promise_nothrow_at_destruct){_m=null_ptr;return *this;}
9571 this_t&operator=(nullptr_t)&noexcept(promise_nothrow_at_destruct){return *this=null_ptr;}
9572 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9573 this_t&operator=(const T&a)&noexcept(promise_nothrow_at_destruct){
9574 base_t::operator=(a);
9575 return*this;
9576 }
9577 template<class T> requires(get_data_able<T>)
9578 this_t&operator=(T&&a)noexcept(get_data_nothrow<T> && promise_nothrow_at_destruct){
9579 _m=get_data_from(forward<T>(a));
9580 return*this;
9581 }
9582
9583 this_t deep_copy(){return this_t{copy_get(_m.get())};}
9584
9585 [[nodiscard]]explicit operator bool()const noexcept{
9586 return bool(_m);
9587 }
9588
9589 Ret_t operator()(Args_t...args)noexcept{
9591 return base_t::call(forward<Args_t>(args)...);
9592 }
9593 Ret_t operator()(Args_t...args)const noexcept{
9595 return base_t::call(forward<Args_t>(args)...);
9596 }
9597
9598 private:
9599 //以下是突然想加的功能(没什么用<迷惑行为大赏>).
9600 static thread_local inline base_t::base_t_w* _func_ptr_data_local=nullptr;
9601 static inline ::std::atomic<decltype(_func_ptr_data_local)> _func_ptr_data_gobal=nullptr;
9602 static Ret_t _func_ptr_value(Args_t...args)noexcept{
9603 if(!_func_ptr_data_local)
9604 _func_ptr_data_local=_func_ptr_data_gobal.load(::std::memory_order_relaxed);
9605 return _func_ptr_data_local->call(forward<Args_t>(args)...);
9606 }
9607 public:
9608 //自当前function对象生成一个函数指针,具有与当前function对象相同的行为
9609 //注意:该函数指针的有效性保留到当前线程下一个同类型的函数指针生成时或当前function对象析构时
9610 //若自该函数指针创建一个新的线程,该函数指针在新线程中的行为与调用时以前所有线程中最后一个生成的同类型的函数指针行为相同
9611 [[nodiscard]]explicit operator func_ptr_t()const noexcept(promise_nothrow_at_destruct){
9612 func_ptr_t a=(func_ptr_t)_m->get_func_ptr();
9613 if(a)return a;
9614 _func_ptr_data_local=base_t::_m.get();
9615 _func_ptr_data_gobal.store(_func_ptr_data_local,::std::memory_order_relaxed);
9616 return _func_ptr_value;
9617 }
9618 };
9619 #endif
9620 template<class T,bool promise_nothrow_at_destruct>
9622 a.swap_with(b);
9623 }
9624 }
9625
9626 //file_end
9627
9628 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9629 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/defs.hpp"
9630 //defs.hpp
9631 //at namespace elc::defs::container
9632 /*
9633 未完成的elc解释器base文件
9634 由steve02081504与Alex0125设计、编写
9635 转载时请在不对此文件做任何修改的同时注明出处
9636 项目地址:https://github.com/steve02081504/ELC
9637 */
9638 namespace function_n{
9639 template<class T>
9641
9642 //[[deprecated("not safe")]]//用这么长名字的人大概知道自己在干啥
9643 template<class T>
9645 }
9646
9647 //file_end
9648
9649 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9650 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/deduction_guides.hpp"
9651 //deduction_guides.hpp
9652 //at namespace elc::defs::container
9653 /*
9654 未完成的elc解释器base文件
9655 由steve02081504与Alex0125设计、编写
9656 转载时请在不对此文件做任何修改的同时注明出处
9657 项目地址:https://github.com/steve02081504/ELC
9658 */
9659 namespace function_n{
9660 template<typename T,typename Func_t=get_function_type<T>,bool promise_nothrow_at_destruct>
9661 base_function_t(T)->base_function_t<Func_t,promise_nothrow_at_destruct>;
9662 }
9663
9664 //file_end
9665
9666 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9667 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_export.hpp"
9668 //_export.hpp
9669 //at namespace elc::defs::container
9670 /*
9671 未完成的elc解释器base文件
9672 由steve02081504与Alex0125设计、编写
9673 转载时请在不对此文件做任何修改的同时注明出处
9674 项目地址:https://github.com/steve02081504/ELC
9675 */
9676 #define export using function_n::
9677 export function_t;
9678 //export may_throw_in_destruct_function_t;
9679 #undef export
9680
9681 //file_end
9682
9683 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9684 #if defined(ELC_TEST_ON)
9685 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_test.hpp"
9686 //_test.hpp
9687 //at namespace elc::defs::container
9688 /*
9689 未完成的elc解释器base文件
9690 由steve02081504与Alex0125设计、编写
9691 转载时请在不对此文件做任何修改的同时注明出处
9692 项目地址:https://github.com/steve02081504/ELC
9693 */
9694 namespace function_n{
9695 //BLOCK:for debug
9696 inline void test(){
9697 ELC_TEST_EVENTNAME("function部分测试");
9698 {
9699 int tester=0;
9700 #if !defined(_MSC_VER)
9701 function_t
9702 #else
9703 function_t<void()noexcept>
9704 #endif
9705 a(lambda_with_catch (&tester)()noexcept{ tester=1; });
9706 static_assert(type_info<decltype(a)> == type_info<function_t<void()noexcept>>);
9707 stest_accert(tester==0);
9708 a();
9709 stest_accert(tester==1);
9710 #if !defined(_MSC_VER)
9711 function_t
9712 #else
9713 function_t<void()>
9714 #endif
9715 b=test;
9716 static_assert(type_info<decltype(b)> == type_info<function_t<void()>>);
9717 b=a;
9718 a=null_ptr;
9719 tester=0;
9720 a();
9721 stest_accert(tester==0);
9722 b();
9723 stest_accert(tester==1);
9724 swap(a,a);
9725 stest_accert(a!=b);
9726 b=a;
9727 stest_accert(a==b);
9728 }
9729 check_memory_lack();
9730 }
9731 inline void test_log_out(){
9732 }
9733 inline void test_end(){
9734 }
9735 //BLOCK_END
9736 }
9737
9738 //file_end
9739
9740 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9741 #endif
9742
9743 //file_end
9744
9745 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
9746
9747 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
9748 //_body.hpp
9749 //at namespace elc::defs::container
9750 /*
9751 未完成的elc解释器base文件
9752 由steve02081504与Alex0125设计、编写
9753 转载时请在不对此文件做任何修改的同时注明出处
9754 项目地址:https://github.com/steve02081504/ELC
9755 */
9756 namespace stack_n{
9757 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/base_stack.hpp"
9758 //defs.hpp
9759 //at namespace elc::defs::container::stack_n
9760 /*
9761 未完成的elc解释器base文件
9762 由steve02081504与Alex0125设计、编写
9763 转载时请在不对此文件做任何修改的同时注明出处
9764 项目地址:https://github.com/steve02081504/ELC
9765 */
9766 template<typename T>
9767 class base_stack_t:non_copyable{//基础容器,可用于hashtable
9768 typedef base_stack_t<T>this_t;
9769 protected:
9770 struct data_t{
9773
9774 constexpr_as(construct<T>(declvalue(const T&)))data_t(const T&a,data_t*b)noexcept(construct<T>.nothrow<const T&>):_data(a),_next(b){}
9775 constexpr_as(construct<T>(declvalue(const T&)))data_t(const data_t&a)noexcept(construct<T>.nothrow<const T&>):_data(a._data),_next(null_ptr){}
9777 size_t _size;
9778 private:
9779 this_t copy()const noexcept(copy_get.nothrow<data_t>){
9780 this_t tmp;
9781 const data_t*p=_m;
9782 data_t**p_=&tmp._m;
9783 while(p!=null_ptr){
9784 *p_=copy_get(p);
9785 p_=&(**p_)._next;
9786 p=p->_next;
9787 }
9788 tmp._size=size();
9789 return tmp;
9790 }
9791 public:
9792 constexpr base_stack_t()noexcept:_m(null_ptr),_size(0){}
9793 void swap_with(this_t&a)noexcept{
9794 swap(_m,a._m);
9795 swap(_size,a._size);
9796 }
9798 swap_with(a);
9799 return*this;
9800 }
9802 operator=(move(a));
9803 }
9805 return operator=(a.copy());
9806 }
9808 ~base_stack_t()noexcept(unget.nothrow<data_t>){
9809 suppress_msvc_warning(26494)//未初始化警告diss
9810 data_t*tmp;
9811 while(_m!=null_ptr){
9812 tmp=_m;
9813 _m=_m->_next;
9814 unget(tmp);
9815 }
9816 }
9817 void clear()noexcept(re_construct.nothrow<this_t>){
9818 re_construct(this);
9819 }
9820 [[nodiscard]]bool empty()const noexcept{
9821 return _m==null_ptr;
9822 }
9823 template<typename U>
9825 data_t*tmp=_m;
9826 while(tmp!=null_ptr){
9827 if(tmp->_data==a)
9828 return tmp->_data;
9829 tmp=tmp->_next;
9830 }
9831 return note::fail;
9832 }
9833 [[nodiscard]]bool in_stack(const T&a)const noexcept_as(declvalue(this_t).find(a).not_fail()){
9834 return remove_const(this)->find(a).not_fail();
9835 }
9836 [[nodiscard]]bool not_in_stack(const T&a)const noexcept_as(declvalue(this_t).in_stack(a)){
9837 return not in_stack(a);
9838 }
9839 [[nodiscard]]size_t size()const noexcept{
9840 return _size;
9841 }
9842
9843 static constexpr bool add_nothrow=noexcept(get<data_t>(declvalue(const T&),declvalue(data_t*)));
9844 void add(const T&a)noexcept(add_nothrow){
9845 _m=get<data_t>(a,_m);
9846 _size++;
9847 }
9848
9849 static constexpr bool remove_nothrow=unget.nothrow<data_t>;
9850 template<typename T_>
9851 bool remove(const T_&a)noexcept(remove_nothrow && equal.nothrow<T_,T>){//返回值:是否成功移除(容器里是否有此T)
9852 data_t*tmp=_m,**tmp_=&_m;
9853 while(tmp!=null_ptr){
9854 if(a==tmp->_data){
9855 _size--;
9856 *tmp_=tmp->_next;
9857 unget(tmp);
9858 return true;
9859 }
9860 tmp_=&tmp->_next;
9861 tmp=*tmp_;
9862 }
9863 return false;
9864 }
9865 #define expr declvalue(func_t)(declvalue(T&))
9866 template<typename func_t> requires was_not_an_ill_form(expr)
9867 void for_each(func_t&&func)noexcept_as(expr){
9868 data_t*tmp=_m;
9869 while(tmp!=null_ptr){
9870 func(tmp->_data);
9871 tmp=tmp->_next;
9872 }
9873 }
9874 #undef expr
9875
9876 #define expr declvalue(func_t)(declvalue(const T&))
9877 template<typename func_t> requires was_not_an_ill_form(expr)
9878 void for_each(func_t&&func)const noexcept_as(expr){
9879 const data_t*tmp=_m;
9880 while(tmp!=null_ptr){
9881 func(tmp->_data);
9882 tmp=tmp->_next;
9883 }
9884 }
9885 #undef expr
9886 protected:
9887 void add(data_t*a)noexcept{
9888 a->_next=_m;
9889 _m=a;
9890 _size++;
9891 }
9892 public:
9894 if(_m)
9895 return hash(_m->_data);
9896 else
9897 return hash(_m);
9898 }
9899 void move_top_to(this_t&a)noexcept{
9900 _size--;
9901 auto tmp=_m;
9902 _m=_m->_next;
9903 a.add(tmp);
9904 }
9905 };
9906
9907 //file_end
9908
9909 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
9910 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/auto_stack.hpp"
9911 //defs.hpp
9912 //at namespace elc::defs::container::stack_n
9913 /*
9914 未完成的elc解释器base文件
9915 由steve02081504与Alex0125设计、编写
9916 转载时请在不对此文件做任何修改的同时注明出处
9917 项目地址:https://github.com/steve02081504/ELC
9918 */
9919 template<typename T>
9920 struct auto_stack_t:base_stack_t<T>{//提头优化容器,可用于hashtable
9921 private:
9922 typedef base_stack_t<T>base_t;
9923 typedef auto_stack_t<T>this_t;
9924
9925 using base_t::data_t;
9926 using base_t::_m;
9927 public:
9928 using base_t::base_t;
9931
9932 this_t&operator=(this_t&&a)&noexcept{base_t::operator=(move(a));return*this;}
9933 template<typename U>
9935 data_t*tmp=_m,**tmp_=&_m;
9936 while(tmp!=null_ptr){
9937 if(tmp->_data==a){
9938 *tmp_=tmp->_next;
9939 tmp->_next=_m;//提头
9940 _m=tmp;
9941 return tmp->_data;
9942 }
9943 tmp_=&tmp->_next;
9944 tmp=*tmp_;
9945 }
9946 return note::fail;
9947 }
9948 [[nodiscard]]bool in_stack(const T&a)const noexcept_as(declvalue(this_t).find(a).not_fail()){
9949 return remove_const(this)->find(a).not_fail();
9950 }
9951 [[nodiscard]]bool not_in_stack(const T&a)const noexcept_as(declvalue(this_t).in_stack(a)){
9952 return not in_stack(a);
9953 }
9954 };
9955
9956 //file_end
9957
9958 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
9959
9960 #if defined(ELC_TEST_ON)
9961 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_test.hpp"
9962 //_test.hpp
9963 //at namespace elc::defs::container::stack_n
9964 /*
9965 未完成的elc解释器base文件
9966 由steve02081504与Alex0125设计、编写
9967 转载时请在不对此文件做任何修改的同时注明出处
9968 项目地址:https://github.com/steve02081504/ELC
9969 */
9970 inline void test(){
9971 ELC_TEST_EVENTNAME("stack部分测试");
9972 {
9973 base_stack_t<int>a;
9974 stest_accert(a.size()==0);
9975 a.add(1);
9976 a.add(2);
9977 a.add(3);
9978 stest_accert(a.size()==3);
9979 a.remove(2);
9980 stest_accert(a.size()==2);
9981 int add_num=0;
9982 a.for_each(lambda_with_catch(&add_num)(int a){add_num+=a;});
9983 stest_accert(add_num==4);
9984 auto_stack_t<int>b=a;
9985 stest_accert(b.not_in_stack(2));
9986 b.remove(3);
9987 stest_accert(a.in_stack(3));
9988 a.clear();
9989 b=a;
9990 a=b;
9991 stest_accert(b.size()==0);
9992 }
9993 check_memory_lack();
9994 }
9995 inline void test_log_out(){
9996 }
9997 inline void test_end(){
9998 }
9999
10000 //file_end
10001
10002 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
10003 #endif
10004 }
10005 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_export.hpp"
10006 //_export.hpp
10007 //at namespace elc::defs::container
10008 /*
10009 未完成的elc解释器base文件
10010 由steve02081504与Alex0125设计、编写
10011 转载时请在不对此文件做任何修改的同时注明出处
10012 项目地址:https://github.com/steve02081504/ELC
10013 */
10014 #define export using stack_n::
10015 export auto_stack_t;
10016 export base_stack_t;
10017 #undef export
10018
10019 //file_end
10020
10021 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
10022
10023 //file_end
10024
10025 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10026 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10027 //_body.hpp
10028 //at namespace elc::defs::container
10029 /*
10030 未完成的elc解释器base文件
10031 由steve02081504与Alex0125设计、编写
10032 转载时请在不对此文件做任何修改的同时注明出处
10033 项目地址:https://github.com/steve02081504/ELC
10034 */
10035 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/defs.hpp"
10036 //defs.hpp
10037 //at namespace elc::defs::container
10038 /*
10039 未完成的elc解释器base文件
10040 由steve02081504与Alex0125设计、编写
10041 转载时请在不对此文件做任何修改的同时注明出处
10042 项目地址:https://github.com/steve02081504/ELC
10043 */
10044 namespace hash_table_n{
10045 template<typename T,template<typename>class stack_t=auto_stack_t,size_t bucket_max_size=256>
10048 typedef stack_t<T>bucket_t;
10049 public:
10050 typedef array_t<bucket_t>base_t_w;
10051 private:
10052 base_t_w _m;
10053 public:
10054 void swap(base_t_w&a)noexcept{_m.swap_with(a);}
10055 private:
10056 [[nodiscard]]bucket_t&find_bucket(hash_t a)noexcept{
10057 return _m[a%_m.size()];
10058 }
10059 void bucket_count_grow()noexcept{
10060 this_t tmp(special_init,get_next_gold_size_to_resize_for_hash(_m.size()));
10061 for(bucket_t&a:_m){
10062 while(!a.empty())
10063 a.move_top_to(tmp.find_bucket(a.get_top_hash()));
10064 }
10065 swap(tmp);
10066 }
10067 hash_table_t(const base_t_w&a)noexcept:_m(a){}
10068 this_t copy()noexcept(copy_construct.nothrow<base_t_w>){
10069 return{_m};
10070 }
10071 public:
10072 hash_table_t()noexcept:_m(5){}
10073 hash_table_t(special_init_t,size_t bucket_size)noexcept:_m(bucket_size){}
10074 ~hash_table_t()noexcept(destruct.nothrow<base_t_w>)=default;
10075
10076 operator base_t_w&()noexcept{return _m;}
10077 operator const base_t_w&()const noexcept{return _m;}
10078
10079 hash_table_t(const this_t&a)noexcept:_m(a._m){}
10080 hash_table_t(this_t&&a)noexcept:_m(a._m){}
10081
10083 swap(_m,a);
10084 return*this;
10085 }
10086 this_t&operator=(const base_t_w&a)&noexcept{
10087 _m=a;
10088 return*this;
10089 }
10090
10091 template<typename U>
10092 static constexpr bool hash_nothrow=noexcept(hash(declvalue(U)));
10093 template<typename U>
10094 static constexpr bool find_nothrow=hash_nothrow<U>&&noexcept(declvalue(bucket_t).find(declvalue(U)));
10095
10096 void add(const T&a)noexcept(hash_nothrow<const T&>&&bucket_t::add_nothrow){
10097 auto&bucket=find_bucket(hash(a));
10098 bucket.add(a);
10099 if(bucket.size() > bucket_max_size)
10100 bucket_count_grow();
10101 }
10102 bool remove(const T&a)noexcept(bucket_t::remove_nothrow){
10103 auto&bucket=find_bucket(hash(a));
10104 bool remove_success=bucket.remove(a);
10105 if constexpr(is_unstable_hash<T>)
10106 if(not remove_success){
10107 for(auto&i:_m){
10108 if(is_eq(i,bucket))
10109 continue;
10110 remove_success=i.remove(a);
10111 if(remove_success)
10112 break;
10113 }
10114 }
10115 return remove_success;
10116 }
10117 template<typename U>
10118 [[nodiscard]]maybe_fail_reference<T>find(U&&a)noexcept(find_nothrow<U>){
10119 auto&bucket=find_bucket(hash(a));
10120 suppress_msvc_warning(26496)//?
10121 auto reference=bucket.find(a);
10122 if constexpr(is_unstable_hash<T>)
10123 if(reference.fail()){
10124 for(auto&i:_m){
10125 if(is_eq(i,bucket))
10126 continue;
10127 re_construct[&reference](i.find(a));
10128 if(reference.not_fail())
10129 break;
10130 }
10131 }
10132 return reference;
10133 }
10134 [[nodiscard]]bool in_table(const T&a)noexcept_as(declvalue(this_t).find(a).not_fail()){
10135 return find(a).not_fail();
10136 }
10137 [[nodiscard]]bool not_in_table(const T&a)noexcept_as(declvalue(this_t).in_table(a)){
10138 return not in_table(a);
10139 }
10140
10141 size_t size()noexcept{
10142 size_t aret=0;
10143 for(const bucket_t&a:_m){
10144 aret+=a.size();
10145 }
10146 return aret;
10147 }
10148
10149 void clear()noexcept(re_construct.nothrow<this_t>){
10150 re_construct(this);
10151 }
10152
10153 #define expr declvalue(func_t)(declvalue(T&))
10154 template<typename func_t> requires was_not_an_ill_form(expr)
10155 void for_each(func_t&&func)noexcept_as(expr){
10156 for(bucket_t&a:_m){
10157 a.for_each(func);
10158 }
10159 }
10160 #undef expr
10161
10162 #define expr declvalue(func_t)(declvalue(const T&))
10163 template<typename func_t> requires was_not_an_ill_form(expr)
10164 void for_each(func_t&&func)const noexcept_as(expr){
10165 for(bucket_t&a:_m){
10166 a.for_each(func);
10167 }
10168 }
10169 #undef expr
10170
10171 #define expr declvalue(func_t)(declvalue(bucket_t&))
10172 template<typename func_t> requires was_not_an_ill_form(expr)
10173 void for_each_bucket(func_t&&func)noexcept_as(expr){
10174 _m.for_each(func);
10175 }
10176 #undef expr
10177
10178 #define expr declvalue(func_t)(declvalue(const bucket_t&))
10179 template<typename func_t> requires was_not_an_ill_form(expr)
10180 void for_each_bucket(func_t&&func)const noexcept_as(expr){
10181 _m.for_each(func);
10182 }
10183 #undef expr
10184 };
10185 template<typename T,template<typename>class stack_t,size_t _,size_t __>
10186 inline void swap(hash_table_t<T,stack_t,_>&a,hash_table_t<T,stack_t,__>&b)noexcept{a.swap(b);}
10187 template<typename T,template<typename>class stack_t,size_t _>
10188 inline void swap(hash_table_t<T,stack_t,_>&a,typename hash_table_t<T,stack_t,_>::base_t_w&b)noexcept{a.swap(b);}
10189 template<typename T,template<typename>class stack_t,size_t _>
10190 inline void swap(typename hash_table_t<T,stack_t,_>::base_t_w&b,hash_table_t<T,stack_t,_>&a)noexcept{a.swap(b);}
10191 }
10192
10193 //file_end
10194
10195 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10196 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_export.hpp"
10197 //_export.hpp
10198 //at namespace elc::defs::container
10199 /*
10200 未完成的elc解释器base文件
10201 由steve02081504与Alex0125设计、编写
10202 转载时请在不对此文件做任何修改的同时注明出处
10203 项目地址:https://github.com/steve02081504/ELC
10204 */
10205 #define export using hash_table_n::
10206 export hash_table_t;
10207 #undef export
10208
10209 //file_end
10210
10211 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10212 #if defined(ELC_TEST_ON)
10213 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_test.hpp"
10214 //_test.hpp
10215 //at namespace elc::defs::container
10216 /*
10217 未完成的elc解释器base文件
10218 由steve02081504与Alex0125设计、编写
10219 转载时请在不对此文件做任何修改的同时注明出处
10220 项目地址:https://github.com/steve02081504/ELC
10221 */
10222 namespace hash_table_n{
10223 //BLOCK:for debug
10224 inline void test(){
10225 ELC_TEST_EVENTNAME("hash_table部分测试");
10226 {
10227
10228 }
10229 check_memory_lack();
10230 }
10231 inline void test_log_out(){
10232 }
10233 inline void test_end(){
10234 }
10235 //BLOCK_END
10236 }
10237
10238 //file_end
10239
10240 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10241 #endif
10242
10243 //file_end
10244
10245 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10246
10247 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10248 //_body.hpp
10249 //at namespace elc::defs::container
10250 /*
10251 未完成的elc解释器base文件
10252 由steve02081504与Alex0125设计、编写
10253 转载时请在不对此文件做任何修改的同时注明出处
10254 项目地址:https://github.com/steve02081504/ELC
10255 */
10256 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/defs.hpp"
10257 //defs.hpp
10258 //at namespace elc::defs::container
10259 /*
10260 未完成的elc解释器base文件
10261 由steve02081504与Alex0125设计、编写
10262 转载时请在不对此文件做任何修改的同时注明出处
10263 项目地址:https://github.com/steve02081504/ELC
10264 */
10265 namespace map_n{
10266 template<typename T,typename key_t,template<typename>class stack_t=auto_stack_t,size_t bucket_max_size=256>
10267 class map_t{
10269
10270 struct data_t{
10271 key_t _key;
10272 T _value;
10273
10274 data_t(const data_t&) = default;
10275 data_t(const key_t&a,const T&b)noexcept(copy_construct.nothrow<key_t> && copy_construct.nothrow<T>):_key(a),_value(b){}
10276
10278 const T*_m;
10279 constexpr seek_value_t(const T&a):_m(addressof(a)){};
10280 [[nodiscard]]bool operator==(const data_t&a)const noexcept_as(a._value==*_m){
10281 return bool(a._value==*_m);
10282 }
10283 };
10284
10285 [[nodiscard]]bool operator==(const key_t&a)noexcept_as(_key==a){
10286 return bool(_key==a);
10287 }
10288 [[nodiscard]]constexpr_as(hash(_key))operator decltype(hash(_key))()const noexcept_as(hash(_key)){
10289 return hash(_key);
10290 }
10291 /* operator T&()noexcept{
10292 return _value;
10293 } */
10294 [[nodiscard]]bool empty(){
10295 return _value==const_default_value_of<T>;
10296 }
10297 };
10298 typedef hash_table_t<data_t,stack_t,bucket_max_size>base_t_w;
10299
10300 mutable base_t_w _m;//mutable cause shrink.
10301
10302 map_t(const base_t_w&a)noexcept:_m(a){}
10303 this_t copy()noexcept(copy_construct.nothrow<base_t_w>){
10304 return{_m};//不用疑惑,这是deep copy
10305 }
10306 public:
10307 map_t()noexcept=default;
10308 ~map_t()noexcept(destruct.nothrow<base_t_w>)=default;
10309 map_t(const this_t&a)noexcept=default;
10310 map_t(this_t&&a)noexcept=default;
10311
10312 this_t&operator=(this_t&&a)noexcept{
10313 swap(_m,a._m);
10314 return*this;
10315 }
10316 this_t&operator=(const this_t&a)noexcept{
10317 return operator=(a.copy());
10318 }
10319
10320 template<size_t _>
10321 void swap(map_t<T,key_t,stack_t,_>&a)noexcept{swap(_m,a._m);}
10322
10323 [[nodiscard]]T&operator[](const key_t&a)noexcept_as(_m.add({a,T()})){
10324 auto tmp=_m.find(a);
10325 if(tmp.fail()){
10326 _m.add({a,T()});
10327 tmp=_m.find(a);
10328 }
10329 return tmp.get_ref()._value;
10330 }
10331 [[nodiscard]]const T&operator[](const key_t&a)const noexcept{
10332 auto tmp=_m.find(a);
10333 return tmp.fail()?const_default_value_of<T>:tmp.get_ref()._value;
10334 }
10335 void clear()noexcept(re_construct.nothrow<this_t>){
10336 re_construct(this);
10337 }
10338
10339 #define expr declvalue(func_t)(declvalue(T&))
10340 template<typename func_t> requires was_not_an_ill_form(expr)
10341 void for_each(func_t&&func)noexcept_as(expr){
10342 _m.for_each(lambda(data_t&a)noexcept_as(expr){
10343 func(a._value);
10344 });
10345 }
10346 #undef expr
10347
10348 #define expr declvalue(func_t)(declvalue(const T&))
10349 template<typename func_t> requires was_not_an_ill_form(expr)
10350 void for_each(func_t&&func)const noexcept_as(expr){
10351 _m.for_each(lambda(data_t&a)noexcept_as(expr){
10352 func(add_const<T&>(a._value));
10353 });
10354 }
10355 #undef expr
10356
10357 static constexpr bool shrink_nothow=stack_t<data_t>::remove_nothrow;
10358 void shrink()const noexcept(shrink_nothow){
10359 _m.for_each_bucket(lambda(stack_t<data_t>&a)noexcept(shrink_nothow && equal.nothrow<T>){
10360 while(a.remove(data_t::seek_value_t(const_default_value_of<T>)));
10361 });
10362 }
10363
10365
10366 bool operator==(const this_t&a)const noexcept(shrink_nothow && equal.nothrow<T>){
10367 shrink();
10368 a.shrink();
10369 if(size()!=a.size())
10370 return 0;
10371 try{
10372 _m.for_each(lambda_with_catch(&a)(data_t&b){
10373 if(a[b._key]!=b._value)
10374 throw (this_t*)(nullptr);
10375 });
10376 }
10377 catch(this_t*){
10378 return 0;
10379 }
10380 return 1;
10381 }
10382 };
10383 template<typename T,typename key_t,template<typename>class stack_t,size_t _,size_t __>
10384 inline void swap(map_t<T,key_t,stack_t,_>&a,map_t<T,key_t,stack_t,__>&b)noexcept{a.swap(b);}
10385 }
10386
10387 //file_end
10388
10389 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10390 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_export.hpp"
10391 //_export.hpp
10392 //at namespace elc::defs::container
10393 /*
10394 未完成的elc解释器base文件
10395 由steve02081504与Alex0125设计、编写
10396 转载时请在不对此文件做任何修改的同时注明出处
10397 项目地址:https://github.com/steve02081504/ELC
10398 */
10399 #define export using map_n::
10400 export map_t;
10401 #undef export
10402
10403 //file_end
10404
10405 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10406 #if defined(ELC_TEST_ON)
10407 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_test.hpp"
10408 //_test.hpp
10409 //at namespace elc::defs::container
10410 /*
10411 未完成的elc解释器base文件
10412 由steve02081504与Alex0125设计、编写
10413 转载时请在不对此文件做任何修改的同时注明出处
10414 项目地址:https://github.com/steve02081504/ELC
10415 */
10416 namespace map_n{
10417 //BLOCK:for debug
10418 inline void test(){
10419 ELC_TEST_EVENTNAME("map部分测试");
10420 {
10421
10422 }
10423 check_memory_lack();
10424 }
10425 inline void test_log_out(){
10426 }
10427 inline void test_end(){
10428 }
10429 //BLOCK_END
10430 }
10431
10432 //file_end
10433
10434 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10435 #endif
10436
10437 //file_end
10438
10439 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10440
10441 #if defined(ELC_TEST_ON)
10442 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_test.hpp"
10443 //_test.hpp
10444 //at namespace elc::defs::container
10445 /*
10446 未完成的elc解释器base文件
10447 由steve02081504与Alex0125设计、编写
10448 转载时请在不对此文件做任何修改的同时注明出处
10449 项目地址:https://github.com/steve02081504/ELC
10450 */
10451 inline void test(){
10452 ELC_TEST_EVENTNAME("container部分测试");
10453 array_n::test();
10454 function_n::test();
10455 stack_n::test();
10456 }
10457 inline void test_log_out(){
10458 array_n::test_log_out();
10459 function_n::test_log_out();
10460 stack_n::test_log_out();
10461 }
10462 inline void test_end(){
10463 array_n::test_end();
10464 function_n::test_end();
10465 stack_n::test_end();
10466 }
10467
10468 //file_end
10469
10470 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10471 #endif
10472
10473 //file_end
10474
10475 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
10476 }
10477 using namespace container;
10478
10479 namespace memory::gc_n{//gc定义,依赖container(但container依赖memory的其他部分)
10480 //依赖container
10481 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10482 //_body.hpp
10483 //at namespace elc::defs::memory::gc_n
10484 /*
10485 未完成的elc解释器base文件
10486 由steve02081504与Alex0125设计、编写
10487 转载时请在不对此文件做任何修改的同时注明出处
10488 项目地址:https://github.com/steve02081504/ELC
10489 */
10490 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10491 //_body.hpp
10492 //at namespace elc::defs::memory::gc_n
10493 /*
10494 未完成的elc解释器base文件
10495 由steve02081504与Alex0125设计、编写
10496 转载时请在不对此文件做任何修改的同时注明出处
10497 项目地址:https://github.com/steve02081504/ELC
10498 */
10499 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/roots/_body.hpp"
10500 //_body.hpp
10501 //at namespace elc::defs::memory::gc_n
10502 /*
10503 未完成的elc解释器base文件
10504 由steve02081504与Alex0125设计、编写
10505 转载时请在不对此文件做任何修改的同时注明出处
10506 项目地址:https://github.com/steve02081504/ELC
10507 */
10508 struct have_root{};
10509
10510 template<typename T>
10511 class root_of;
10512
10513 template<typename T>
10514 class roots_t{
10515 typedef roots_t<T>this_t;
10516 typedef root_of<T>root_t;
10517 typedef root_of<T>*value_t;
10518
10519 base_stack_t<value_t>_roots;
10520 public:
10521 constexpr roots_t()noexcept=default;
10522 ~roots_t()noexcept=default;
10523
10527 using_method_from_value(for_each,_roots);
10528
10529 void map_and_mark()noexcept_as(declvalue(value_t)->map_and_mark()){
10530 _roots.for_each(
10532 {
10533 a->map_and_mark();
10534 }
10535 );
10536 }
10537 };
10538 template<typename T>
10540
10541 template<typename T>
10542 class root_of{
10543 typedef root_of<T>this_t;
10544 public:
10545 root_of()noexcept_as(roots_of<T>.add(declvalue(this_t*))){
10546 roots_of<T>.add(this);
10547 }
10548 virtual T& get()noexcept=0;
10549 virtual void map_and_mark()noexcept=0;
10550 };
10551 template<typename T>
10552 inline T& root_of<T>::get()noexcept{return const_default_value_of<T>;}
10553 template<typename T>
10554 inline void root_of<T>::map_and_mark()noexcept{}
10555
10556 //file_end
10557
10558 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10559 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/mark_able_for_gc/_body.hpp"
10560 //_body.hpp
10561 //at namespace elc::defs::memory::gc_n
10562 /*
10563 未完成的elc解释器base文件
10564 由steve02081504与Alex0125设计、编写
10565 转载时请在不对此文件做任何修改的同时注明出处
10566 项目地址:https://github.com/steve02081504/ELC
10567 */
10568 template<typename T>
10570 mark_able_for_gc()noexcept:mark_able<T>(not_mark){}
10572 };
10573
10574 //file_end
10575
10576 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10577 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/others/_body.hpp"
10578 //_body.hpp
10579 //at namespace elc::defs::memory::gc_n
10580 /*
10581 未完成的elc解释器base文件
10582 由steve02081504与Alex0125设计、编写
10583 转载时请在不对此文件做任何修改的同时注明出处
10584 项目地址:https://github.com/steve02081504/ELC
10585 */
10588
10589 //file_end
10590
10591 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10592
10593 //file_end
10594
10595 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10596
10597 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10598 //_body.hpp
10599 //at namespace elc::defs::memory::gc_n
10600 /*
10601 未完成的elc解释器base文件
10602 由steve02081504与Alex0125设计、编写
10603 转载时请在不对此文件做任何修改的同时注明出处
10604 项目地址:https://github.com/steve02081504/ELC
10605 */
10606 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/default_method/decl.hpp"
10607 //_body.hpp
10608 //at namespace elc::defs::memory::gc_n
10609 /*
10610 未完成的elc解释器base文件
10611 由steve02081504与Alex0125设计、编写
10612 转载时请在不对此文件做任何修改的同时注明出处
10613 项目地址:https://github.com/steve02081504/ELC
10614 */
10615 template<class T,enable_flag>
10616 inline void gc_method_of()noexcept;
10617 template<class T,enable_flag>
10618 [[nodiscard]]inline bool gc_success_identifier_of()noexcept;
10619
10620 //file_end
10621
10622 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10623 //
10624 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/defs.hpp"
10625 //defs.hpp
10626 //at namespace elc::defs::memory
10627 /*
10628 未完成的elc解释器base文件
10629 由steve02081504与Alex0125设计、编写
10630 转载时请在不对此文件做任何修改的同时注明出处
10631 项目地址:https://github.com/steve02081504/ELC
10632 */
10633 class gc_t{
10634 typedef gc_t this_t;
10635 typedef function_t<void()noexcept>gc_method_t;
10636 typedef function_t<bool()noexcept>success_identifier_t;
10637
10638 base_stack_t<gc_method_t>_gc_methods;
10639 base_stack_t<success_identifier_t>_gc_success_identifiers;
10640 mutable flag _gc_running=flag(not_set);
10641 public:
10642 inline void operator()()const noexcept{
10643 if(_gc_running)
10644 die_with(locale::str::gc_fail);
10645 _gc_running.set();
10646 if(_gc_methods.empty())
10647 die_with(locale::str::empty_gc_method);
10648 _gc_methods.for_each(invoke<const gc_method_t>._as(nothing));
10649 _gc_running.unset();
10650 }
10651 [[nodiscard]]inline bool success()const noexcept{
10652 bool success=_gc_success_identifiers.empty();
10653 _gc_success_identifiers.for_each(
10654 lambda_with_catch(&success)(const success_identifier_t&a)noexcept{
10655 if(not success)
10656 success=a();
10657 }
10658 );
10659 return success;
10660 }
10661
10662 inline void add_gc_method(gc_method_t a)noexcept{
10663 _gc_methods.add(a);
10664 }
10665 inline void remove_gc_method(gc_method_t a){
10666 _gc_methods.remove(a);
10667 }
10668
10669 inline void add_gc_success_identifier(success_identifier_t a)noexcept{
10670 _gc_success_identifiers.add(a);
10671 }
10672 inline void remove_gc_success_identifier(success_identifier_t a){
10673 _gc_success_identifiers.remove(a);
10674 }
10675
10676 template<class T>
10677 inline void add_gc_method(type_info_t<T>)noexcept{
10678 add_gc_method((void(*)()noexcept)gc_method_of<T>);
10679 add_gc_success_identifier(gc_success_identifier_of<T>);
10680 }
10681 template<class T>
10682 inline void remove_gc_method(type_info_t<T>)noexcept{
10683 remove_gc_method(gc_method_of<T>);
10684 remove_gc_success_identifier(gc_success_identifier_of<T>);
10685 }
10686 };
10687
10688 //file_end
10689
10690 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10691 //
10692 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/default_method/defs.hpp"
10693 //_body.hpp
10694 //at namespace elc::defs::memory::gc_n
10695 /*
10696 未完成的elc解释器base文件
10697 由steve02081504与Alex0125设计、编写
10698 转载时请在不对此文件做任何修改的同时注明出处
10699 项目地址:https://github.com/steve02081504/ELC
10700 */
10701 namespace default_gc_for_type{
10702 template<class T,enable_if(type_info<T>.has_attribute(count_able))>
10704
10705 template<class T>
10706 constexpr bool use_default_gc_able =
10707 (
10708 type_info<T>.has_attribute(mark_able_for_gc) &&
10709 type_info<T>.has_attribute(have_root)
10710 )&&(
10711 type_info<T>.has_attribute(can_map_all)
10712 &&(
10713 type_info<T>.has_attribute(can_shrink)
10714 ||(
10715 type_info<T>.has_attribute(mark_able_for_gc) &&
10716 type_info<T>.has_attribute(have_root)
10717 )
10718 )
10719 );
10720
10721 enable_adl(destory_by_gc);
10722 template<class T>
10724 template_error("this function should not be instantiated,please overload the function destory_by_gc in the namespace where this type is defined.");
10725 }
10726
10727 template<class T> requires use_default_gc_able<T>
10728 inline void default_gc_method()noexcept{
10729 constexpr auto&info=type_info<T>;
10730 //
10731 if constexpr(info.has_attribute(count_able))
10732 count_for_success_identify<T> = the_number_of(info);
10733 //
10734 if constexpr(info.has_attribute(can_map_all)){
10735 if constexpr(info.has_attribute(mark_able_for_gc)&&info.has_attribute(have_root))
10736 roots_of<T>.map_and_mark();
10737 if constexpr(info.has_attribute(can_shrink) || (info.has_attribute(mark_able_for_gc)&&info.has_attribute(have_root)))
10738 map_all<T>(
10739 lambda(T*a)noexcept{
10740 if constexpr(info.has_attribute(can_shrink))
10741 a->shrink();
10742 if constexpr(info.has_attribute(mark_able_for_gc)&&info.has_attribute(have_root)){
10743 auto& b=attribute_cast<mark_able_for_gc>(*a);
10744 if(b.was_marked())
10745 b.unmark();
10746 else
10747 destory_by_gc(a);
10748 }
10749 }
10750 );
10751 }
10752 }
10753 //
10754 template<class T>
10755 constexpr bool use_default_gc_success_identifier_able = type_info<T>.has_attribute(count_able);
10756
10757 template<class T> requires use_default_gc_success_identifier_able<T>
10758 [[nodiscard]]inline bool default_gc_success_identifier()noexcept{
10759 constexpr auto&info=type_info<T>;
10760 if constexpr(info.has_attribute(count_able)){//重复判定,勿删,方便日后扩展
10761 return count_for_success_identify<T> _big_than_ the_number_of(info);
10762 }
10763 }
10764 }
10765 template<class T,enable_if(default_gc_for_type::use_default_gc_able<T>)>
10766 inline void gc_method_of()noexcept{
10767 default_gc_for_type::default_gc_method<T>();
10768 }
10769 template<class T,enable_if(default_gc_for_type::use_default_gc_success_identifier_able<T>)>
10770 [[nodiscard]]inline bool gc_success_identifier_of()noexcept{
10771 return default_gc_for_type::default_gc_success_identifier<T>();
10772 }
10773
10774 //file_end
10775
10776 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10777
10778 //file_end
10779
10780 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10781
10782 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/defs.hpp"
10783 //defs.hpp
10784 //at namespace elc::defs::memory::gc_n
10785 /*
10786 未完成的elc解释器base文件
10787 由steve02081504与Alex0125设计、编写
10788 转载时请在不对此文件做任何修改的同时注明出处
10789 项目地址:https://github.com/steve02081504/ELC
10790 */
10792
10793 //file_end
10794
10795 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10796
10797 //for alloc (def in "../alloc/defs.hpp#L10" )
10798 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_for_alloc/_body.hpp"
10799 //_body.hpp
10800 //at namespace elc::defs::memory::gc_n
10801 /*
10802 未完成的elc解释器base文件
10803 由steve02081504与Alex0125设计、编写
10804 转载时请在不对此文件做任何修改的同时注明出处
10805 项目地址:https://github.com/steve02081504/ELC
10806 */
10807 inline void gc_for_alloc()noexcept{
10808 gc();
10809 }
10810
10811 //file_end
10812
10813 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10814 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10815 //_body.hpp
10816 //at namespace elc::defs::memory::gc_n
10817 /*
10818 未完成的elc解释器base文件
10819 由steve02081504与Alex0125设计、编写
10820 转载时请在不对此文件做任何修改的同时注明出处
10821 项目地址:https://github.com/steve02081504/ELC
10822 */
10823 BREAK_NAMESPACE//in namespace elc::defs
10824 INTER_NAMESPACE(memory::ptr_n)
10825
10826 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/defs.hpp"
10827 //defs.hpp
10828 //at namespace elc::defs::memory::ptr_n
10829 /*
10830 未完成的elc解释器base文件
10831 由steve02081504与Alex0125设计、编写
10832 转载时请在不对此文件做任何修改的同时注明出处
10833 项目地址:https://github.com/steve02081504/ELC
10834 */
10835 enable_adl(map_and_mark_for_gc);
10836 template<typename T>
10837 void map_and_mark_for_gc(T*)noexcept{
10838 template_error("this function should not be instantiated,please overload the function map_and_mark_for_gc in the namespace where this type is defined");
10839 }
10840 using ::elc::defs::memory::gc_n::root_of;
10841 template<class T,enable_if(
10842 was_ref_able<T> &&
10843 comn_ptr_t<T>::replace_check_nothrow &&
10844 type_info<T>.has_attribute(gc_n::have_root)
10845 )>
10846 struct root_ptr_t:comn_ptr_t<T>,root_of<T>{
10849 public:
10850 using base_t::base_t;
10851 template<class assign_t> requires was_not_an_ill_form(declvalue(base_t)=declvalue(assign_t))
10852 this_t&operator=(assign_t&&a)noexcept_as(base_t::operator=(forward<assign_t>(a))){
10853 base_t::operator=(forward<assign_t>(a));
10854 return*this;
10855 }
10856 virtual T& get()noexcept override{
10857 return base_t::operator*();
10858 }
10859 virtual void map_and_mark()noexcept override{
10860 map_and_mark_for_gc(&**this);
10861 }
10862 };
10863
10864 //file_end
10865
10866 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10867 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/deduction_guides.hpp"
10868 //deduction_guides.hpp
10869 //at namespace elc::defs::memory::ptr_n
10870 /*
10871 未完成的elc解释器base文件
10872 由steve02081504与Alex0125设计、编写
10873 转载时请在不对此文件做任何修改的同时注明出处
10874 项目地址:https://github.com/steve02081504/ELC
10875 */
10876 template<class T>
10878
10879 //file_end
10880
10881 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10882
10883 BREAK_NAMESPACE//in namespace elc::defs
10884
10885 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_export.hpp"
10886 //_export.hpp
10887 //at namespace elc::defs
10888 /*
10889 未完成的elc解释器base文件
10890 由steve02081504与Alex0125设计、编写
10891 转载时请在不对此文件做任何修改的同时注明出处
10892 项目地址:https://github.com/steve02081504/ELC
10893 */
10894 INTER_NAMESPACE(memory)
10895 #define export using memory::ptr_n::
10897 #undef export
10899
10900 //file_end
10901
10902 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10903
10904 INTER_NAMESPACE(memory::gc_n)
10905
10906 //file_end
10907
10908 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10909
10910 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_export.hpp"
10911 //_export.hpp
10912 //at namespace elc::defs::memory::gc_n
10913 /*
10914 未完成的elc解释器base文件
10915 由steve02081504与Alex0125设计、编写
10916 转载时请在不对此文件做任何修改的同时注明出处
10917 项目地址:https://github.com/steve02081504/ELC
10918 */
10919 BREAK_NAMESPACE//in namespace elc::defs
10920 INTER_NAMESPACE(memory)
10921 #define export using gc_n::
10922 export gc;
10923 export have_root;
10924 export root_of;
10925 export mark_able_for_gc;
10926 export can_shrink;
10927 #undef export
10928 BREAK_NAMESPACE//in namespace elc::defs
10929 INTER_NAMESPACE(memory::gc_n)
10930
10931 //file_end
10932
10933 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10934
10935 #if defined(ELC_TEST_ON)
10936 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_test.hpp"
10937 //_body.hpp
10938 //at namespace elc::defs::memory::gc_n
10939 /*
10940 未完成的elc解释器base文件
10941 由steve02081504与Alex0125设计、编写
10942 转载时请在不对此文件做任何修改的同时注明出处
10943 项目地址:https://github.com/steve02081504/ELC
10944 */
10945 #if!defined(_MSC_VER)//貌似msvc在这里有bug
10946 struct gc_tester:type_info_t<gc_tester>::template_name
10947 with_common_attribute<can_map_all,can_shrink,count_able,mark_able_for_gc,never_in_array,ref_able>,
10949 distinctive static inline int shrink_time=0;
10950 distinctive static inline int destroy_time=0;
10951 ~gc_tester()noexcept{destroy_time++;}
10952 void shrink(){
10953 shrink_time++;
10954 }
10955 static void reset_times(){
10956 shrink_time=destroy_time=0;
10957 }
10958 };
10959 static_assert(type_info<gc_tester>.base_on<can_map_all<gc_tester>>);
10960 void map_and_mark_for_gc(gc_tester*a){
10961 attribute_ptr_cast<mark_able_for_gc>(a)->mark();
10962 }
10963 void destory_by_gc(gc_tester*a){
10964 a->~gc_tester();
10965 }
10966 #endif
10967 inline void test(){
10968 #if!defined(_MSC_VER)
10969 ELC_TEST_EVENTNAME("gc部分测试");
10970 using ::std::time;
10971 using ::std::rand;
10972 using ::std::srand;
10973 srand((unsigned)time(nullptr));
10974 gc.add_gc_method(type_info<gc_tester>);
10975 for(int t=rand()%7;t--;)
10976 {
10977 int i;
10978 root_ptr_t<gc_tester> name=get<gc_tester>();
10979 for(i=rand()%72;i--;){
10980 #pragma warning(suppress: 4189)
10981 auto p=get<gc_tester>();
10982 }
10983 gc();
10984 stest_accert(gc_tester::shrink_time==i+1);
10985 stest_accert(gc_tester::destroy_time==i);
10986 stest_accert(get_size_of_get(&*name)==1);
10987 }
10988 check_memory_lack();
10989 #endif
10990 }
10991 inline void test_log_out(){
10992
10993 }
10994 inline void test_end(){
10995
10996 }
10997
10998 //file_end
10999
11000 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
11001 #endif
11002
11003 //file_end
11004
11005 #line 40 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11006 }
11007 using namespace memory;//只是强迫症
11008
11009 #if defined(ELC_TEST_ON)
11010 namespace base_part_test{
11011 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_test.hpp"
11012 //_test.hpp
11013 //at namespace elc::defs::base_part_test
11014 /*
11015 未完成的elc解释器base文件
11016 由steve02081504与Alex0125设计、编写
11017 转载时请在不对此文件做任何修改的同时注明出处
11018 项目地址:https://github.com/steve02081504/ELC
11019 */
11020 inline void test(){
11021 ELC_TEST_EVENTNAME("base部分测试");
11022 memory::test();
11023 container::test();
11024 gc_n::test();
11025 }
11026 inline void test_log_out(){
11027 memory::test_log_out();
11028 container::test_log_out();
11029 }
11030 inline void test_end(){
11031 memory::test_end();
11032 container::test_end();
11033 }
11034
11035 //file_end
11036
11037 #line 46 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11038 }
11039 #endif
11040
11041 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11042 //_undefs.hpp
11043 /*
11044 未完成的elc解释器basic文件
11045 由steve02081504与Alex0125设计、编写
11046 转载时请在不对此文件做任何修改的同时注明出处
11047 项目地址:https://github.com/steve02081504/ELC
11048 */
11049 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
11050 //_undefs.hpp
11051 /*
11052 未完成的elc解释器_share文件
11053 由steve02081504与Alex0125设计、编写
11054 转载时请在不对此文件做任何修改的同时注明出处
11055 项目地址:https://github.com/steve02081504/ELC
11056 */
11057
11058 //defs at "_defs.hpp"
11059
11060 #if defined(_MSC_VER)
11061 #pragma warning(pop)
11062 #endif
11063 #undef suppress_msvc_warning
11064 #undef disable_msvc_warning
11065 #undef push_msvc_warning
11066 #undef pop_msvc_warning
11067 #undef push_and_disable_msvc_warning
11068
11069 //for basic_environment.hpp
11070 #undef BIT_POSSIBILITY
11071 //
11072 #if defined(ELC_VOID_NAME)
11073 #define void the_void
11074 #endif
11075
11076 // #undef often_noexcept
11077 #undef noexcept_as
11078 #undef noexcept_as_auto
11079 #undef constexpr_as
11080 #undef constexpr_as_auto
11081
11082 #undef using_method_from_base_t
11083 #undef using_method_from_value
11084
11085 #undef floop
11086 #undef enable_adl
11087
11088 #undef re_declvalue
11089 #undef re_decltype
11090
11091 #undef declvalue
11092
11093 #undef template_error
11094 #undef template_warning
11095
11096 #undef type_info_of
11097 #undef type_name_of
11098
11099 #undef is_common_attribute
11100 #undef is_special_attribute
11101
11102 #undef has_attribute
11103 #undef not_has_attribute
11104
11105 #undef float_size_of
11106 #undef bitnum_of
11107
11108 #undef def_common_attribute_with_nothing
11109 #undef def_special_attribute_with_nothing
11110
11111 #undef common_attribute_t
11112 #undef special_attribute_t
11113
11114 #undef enable_if
11115 #undef enabled_by_default
11116 #undef disabled_by_default
11117 #undef enable_if_not_ill_form
11118 #undef enable_flag
11119
11120 #undef was_an_ill_form
11121 #undef was_an_ill_form_with_parameter
11122 #undef was_not_an_ill_form
11123 #undef was_not_an_ill_form_and_noexcept
11124 #undef was_not_an_ill_form_with_parameter
11125
11126 #undef recursive_lambda
11127 #undef get_recursive_lambda_caller
11128 #undef lambda
11129 #undef lambda_with_catch
11130 #undef self_recursion
11131 #undef lambda_RLSRRS
11132
11133 #undef MAGIC
11134
11135 #undef nothing
11136
11137 #undef elseif
11138 #undef _big_than_
11139 #undef _small_than_
11140
11141 #if defined(_MSC_VER)
11142 #undef not
11143 #undef and
11144 #undef or
11145 #endif
11146
11147 #undef INTER_NAMESPACE
11148 #undef BREAK_NAMESPACE
11149
11150 #undef szie
11151 #undef form
11152
11153 #undef template_name
11154 #undef type_name
11155
11156 #undef not_in_debug
11157
11158 #undef es
11159 #undef ec
11160
11161 #undef ELC_TEST_EVENTNAME
11162
11163 #undef override_instance_struct
11164
11165 #undef distinctive
11166
11167 #undef force_inline
11168
11169 #undef with_no_vtable
11170
11171 #undef in_consteval
11172
11173 #undef no_vtable_struct
11174 #undef no_vtable_class
11175
11176 //file_end
11177
11178 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11179
11180 //file_end
11181
11182 #line 50 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11183 }
11184 namespace elc{
11185 //导出base承诺于名称空间elc中提供的内容
11186 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_export.hpp"
11187 //_export.hpp
11188 //at namespace elc
11189 /*
11190 未完成的elc解释器base文件
11191 由steve02081504与Alex0125设计、编写
11192 转载时请在不对此文件做任何修改的同时注明出处
11193 项目地址:https://github.com/steve02081504/ELC
11194 */
11195 #define export using defs::base::
11196 #undef export
11197
11198 //file_end
11199
11200 #line 53 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11201 }
11202
11203 //file_end
11204
11205 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
11206 #endif
11207
11208 //file_end
11209
11210 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
11211 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
11212 //base_defs
11213 //at namespace ::
11214 /*
11215 未完成的elc解释器include文件
11216 由steve02081504与Alex0125设计、编写
11217 转载时请在不对此文件做任何修改的同时注明出处
11218 项目地址:https://github.com/steve02081504/ELC
11219 */
11220 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
11221
11222 //file_end
11223
11224 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
11225 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
11226 //base_exception
11227 //at namespace ::
11228 /*
11229 未完成的elc解释器include文件
11230 由steve02081504与Alex0125设计、编写
11231 转载时请在不对此文件做任何修改的同时注明出处
11232 项目地址:https://github.com/steve02081504/ELC
11233 */
11234 #if !defined(ELC_BASE_EXCEPTION)
11235 #define ELC_BASE_EXCEPTION
11236 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
11237 //using.hpp
11238 /*
11239 未完成的elc解释器_share文件
11240 由steve02081504与Alex0125设计、编写
11241 转载时请在不对此文件做任何修改的同时注明出处
11242 项目地址:https://github.com/steve02081504/ELC
11243 */
11244 /*
11245 locale说明
11246 elc使用的字符串.
11247 调整这些,实现快速本地化.
11248 */
11249 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
11250
11251 //file_end
11252
11253 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
11254 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11255 //_body.hpp
11256 //at namespace ::
11257 /*
11258 未完成的elc解释器base_exception文件
11259 由steve02081504与Alex0125设计、编写
11260 转载时请在不对此文件做任何修改的同时注明出处
11261 项目地址:https://github.com/steve02081504/ELC
11262 */
11263 #if defined(ELC_TEST)
11264 #error "this part cannot be tested."
11265 #endif
11266 //char_t
11267 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
11268 //default_data_type.hpp
11269 /*
11270 未完成的elc解释器_share文件
11271 由steve02081504与Alex0125设计、编写
11272 转载时请在不对此文件做任何修改的同时注明出处
11273 项目地址:https://github.com/steve02081504/ELC
11274 */
11275 namespace elc{
11276 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
11277 typedef char32_t char_t;
11278 /*ELC内部钦定int_t类型*/
11279 typedef int64_t int_t;
11280 /*ELC内部钦定uint_t类型*/
11281 typedef uint64_t uint_t;
11282 /*ELC内部钦定float_t类型*/
11283 typedef double float_t;
11284 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
11285 typedef long double float_size_t;
11286 }
11287
11288 //file_end
11289
11290 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11291 namespace elc::defs{
11292 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
11293 //_defs.hpp
11294 /*
11295 未完成的elc解释器basic文件
11296 由steve02081504与Alex0125设计、编写
11297 转载时请在不对此文件做任何修改的同时注明出处
11298 项目地址:https://github.com/steve02081504/ELC
11299 */
11300 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11301 //_defs.hpp
11302 /*
11303 未完成的elc解释器_share文件
11304 由steve02081504与Alex0125设计、编写
11305 转载时请在不对此文件做任何修改的同时注明出处
11306 项目地址:https://github.com/steve02081504/ELC
11307 */
11308
11309 //undefs at "_undefs.hpp"
11310
11311 //set ELC_WARNING_LEVEL default to 4(max)
11312 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11313
11314 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
11315 //basic_environment.hpp
11316 /*
11317 未完成的elc解释器_share文件
11318 由steve02081504与Alex0125设计、编写
11319 转载时请在不对此文件做任何修改的同时注明出处
11320 项目地址:https://github.com/steve02081504/ELC
11321 */
11322
11323 //每个bit(不是字节)的可能性
11324 //为什么c艹委员会不定义这个?
11325 #define BIT_POSSIBILITY 2
11326
11327 //file_end
11328
11329 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11330
11331 #if defined(_MSC_VER)
11332 #pragma warning(push,ELC_WARNING_LEVEL)
11333 #pragma warning(disable:4099)//class与struct混用警告diss
11334 #pragma warning(disable:26812)//enum class安利diss.
11335 #pragma warning(disable:4584)//重复子类警告diss
11336 #pragma warning(disable:4250)//域控制继承警告diss
11337 #pragma warning(disable:26432)//不完全默认方法警告diss
11338 #pragma warning(disable:26435)//virtual override方法警告diss
11339 #pragma warning(disable:26481)//容器安利diss
11340 #pragma warning(disable:26446)//gsl::at安利diss
11341 #pragma warning(disable:26434)//方法覆盖警告diss
11342 #pragma warning(disable:26429)//gsl::not_null安利diss
11343 #pragma warning(disable:26471)//对void*进行static_cast安利diss
11344 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
11345 #pragma warning(disable:26473)//相同指针显式cast警告diss
11346 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
11347 #pragma warning(disable:26485)//数组作指针警告diss
11348 #pragma warning(disable:26490)//reinterpret_cast警告diss
11349 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
11350 #pragma warning(disable:26482)//非常数数组索引警告diss
11351 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
11352 #endif
11353 #if defined(_MSC_VER)
11354 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
11355 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
11356 #define push_msvc_warning() __pragma(warning(push))
11357 #define pop_msvc_warning() __pragma(warning(pop))
11358 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
11359 #else
11360 #define suppress_msvc_warning(...)
11361 #define disable_msvc_warning(...)
11362 #define push_msvc_warning()
11363 #define pop_msvc_warning()
11364 #define push_and_disable_msvc_warning(...)
11365 #endif
11366 //
11367 #if defined(ELC_VOID_NAME)
11368 #undef void
11369 #endif
11370
11371 // #define often_noexcept
11372 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
11373 #define noexcept_as_auto MAGIC//哦现在有了
11374 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
11375 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
11376
11377 #define using_method_from_base_t(name,...) \
11378 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
11379 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
11380 {\
11381 return base_t::name(forward<Args>(rest)...);\
11382 }\
11383
11384 #define using_method_from_value(name,value_name,...) \
11385 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
11386 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
11387 {\
11388 return value_name.name(forward<Args>(rest)...);\
11389 }\
11390
11391 #define floop while(__builtin_is_my_dick_still_there())
11392 #define enable_adl(name) void name()noexcept=delete
11393
11394 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
11395 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
11396
11397 #define declvalue(...) (::std::declval<__VA_ARGS__>())
11398
11399 /*实例化到此将引发错误*/
11400 #define template_error(reason) static_assert(template_error_helper<T>,reason)
11401 /*实例化到此将引发警告*/
11402 #define template_warning(reason) template_warning_helper<T>(reason)
11403
11404 //for type_info
11405 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
11406 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
11407
11408 #define is_common_attribute(name) public attribute<T,name<T>>
11409 #define is_special_attribute(name) public attribute<T,name>
11410
11411 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
11412 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
11413
11414 //for float_size_t
11415 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
11416 //bitnum_of
11417 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
11418
11419 //for attribute
11420 #define def_common_attribute_with_nothing(name) \
11421 template<typename T>\
11422 class name{}\
11423
11424 #define def_special_attribute_with_nothing(name) \
11425 class name{}\
11426
11427 #define common_attribute_t template<class>class
11428 #define special_attribute_t class
11429
11430 /*
11431 若参数的布尔值为零,那么此模板不会实例化
11432
11433 为什么不用cpp20的constraints?
11434 1.不能类内定义
11435 2.不能作为模板参数
11436 一句话总结:c艹标准会sb
11437 */
11438 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
11439 /*默认参与模板候选*/
11440 #define enabled_by_default class enable_state=void
11441 /*默认不参与模板候选*/
11442 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
11443 /*若参数为病式,那么此模板不会实例化*/
11444 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
11445 /*用于模板声明*/
11446 #define enable_flag class enable_state
11447
11448 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
11449 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
11450 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
11451 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
11452 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
11453
11454 /*让lambda递归更加美观*/
11455 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
11456 /*让lambda递归更加美观*/
11457 #define get_recursive_lambda_caller(name) \
11458 lambda_with_catch(&)(auto&&...Args){\
11459 return name(name,Args...);\
11460 }
11461 /*让lambda定义更加美观*/
11462 #define lambda []
11463 /*让lambda定义更加美观*/
11464 #define lambda_with_catch(...) [__VA_ARGS__]
11465 /*让lambda递归更加美观*/
11466 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
11467 //recursive_lambda_self_referential_reserved_symbolname
11468 #define lambda_RLSRRS _my_jb_super_sb_name_
11469
11470 #define MAGIC//ahh,ko no tenno da!
11471
11472 /*装饰性语法糖*/
11473 #define nothing
11474
11475 /*aya风格语法糖*/
11476 #define elseif else if
11477 /*aya风格语法糖*/
11478 #define _big_than_ >
11479 /*aya风格语法糖*/
11480 #define _small_than_ <
11481
11482 #if defined(_MSC_VER)
11483 #define not !
11484 #define and &&
11485 #define or ||
11486 #endif
11487
11488 /*进入名称空间,并不是很美观*/
11489 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
11490 /*退出名称空间,并不是很美观*/
11491 #define BREAK_NAMESPACE }
11492
11493 /*template说明符*/
11494 #define template_name template
11495 /*template说明符*/
11496 #define type_name class
11497
11498 #if defined(DEBUG) || defined(_DEBUG)
11499 #define not_in_debug 0
11500 #else
11501 #define not_in_debug 1
11502 #endif
11503
11504 #define es U""
11505 #define ec(ch) U ## ch
11506
11507 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
11508 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
11509 #else
11510 #define ELC_TEST_EVENTNAME(name)
11511 #endif
11512
11513 #define override_instance_struct \
11514 protected:\
11515 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
11516 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
11517 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
11518 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
11519 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
11520
11521 #if defined(_WIN32)
11522 #define distinctive __declspec(dllexport)
11523 #else
11524 #define distinctive
11525 #endif
11526
11527 #if defined(_WIN32)
11528 #define force_inline __forceinline
11529 #elif defined(__GNUC__)
11530 #define force_inline __attribute__((always_inline)) inline
11531 #else
11532 #define force_inline inline
11533 #endif
11534
11535 #if defined(_WIN32)
11536 #define with_no_vtable __declspec(novtable)
11537 #else
11538 #define with_no_vtable
11539 #endif
11540
11541 #define in_consteval (::std::is_constant_evaluated())
11542
11543 #define no_vtable_struct struct with_no_vtable
11544 #define no_vtable_class class with_no_vtable
11545
11546 //file_end
11547
11548 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
11549
11550 //file_end
11551
11552 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11553
11554 namespace exception_n{
11555 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/exception/_body.hpp"
11556 //_body.hpp
11557 //at namespace elc::defs::exception_n
11558 /*
11559 未完成的elc解释器base_exception文件
11560 由steve02081504与Alex0125设计、编写
11561 转载时请在不对此文件做任何修改的同时注明出处
11562 项目地址:https://github.com/steve02081504/ELC
11563 */
11564 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/exception/exception.hpp"
11565 //_body.hpp
11566 //at namespace elc::defs::exception_n
11567 /*
11568 未完成的elc解释器base_exception文件
11569 由steve02081504与Alex0125设计、编写
11570 转载时请在不对此文件做任何修改的同时注明出处
11571 项目地址:https://github.com/steve02081504/ELC
11572 */
11574 const char_t* _constexpr_str=locale::str::exception::unknow_error;
11575 public:
11576 constexpr exception()noexcept=default;
11577 constexpr exception(const constexpr_str_t<char_t>&str)noexcept:_constexpr_str(str){}
11578 virtual constexpr ~exception()noexcept=0;
11579 virtual constexpr const char_t*what()noexcept{return _constexpr_str;}
11580 };
11581 inline constexpr exception::~exception()noexcept{}
11582
11584 using exception::exception;
11585 };
11586
11587 //file_end
11588
11589 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/exception/_body.hpp"
11590
11591 //file_end
11592
11593 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11594 }
11595 namespace exceptions=exception_n;
11596
11597 #if defined(ELC_TEST_ON)
11598 namespace base_exception_part_test{
11599 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_test.hpp"
11600 //_test.hpp
11601 /*
11602 未完成的elc解释器base_exception文件
11603 由steve02081504与Alex0125设计、编写
11604 转载时请在不对此文件做任何修改的同时注明出处
11605 项目地址:https://github.com/steve02081504/ELC
11606 */
11607 inline void test(){
11608 ELC_TEST_EVENTNAME("base_exception部分测试");
11609 }
11610 inline void test_log_out(){
11611 }
11612 inline void test_end(){
11613 }
11614
11615 //file_end
11616
11617 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11618 }
11619 #endif
11620
11621 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11622 //_undefs.hpp
11623 /*
11624 未完成的elc解释器basic文件
11625 由steve02081504与Alex0125设计、编写
11626 转载时请在不对此文件做任何修改的同时注明出处
11627 项目地址:https://github.com/steve02081504/ELC
11628 */
11629 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
11630 //_undefs.hpp
11631 /*
11632 未完成的elc解释器_share文件
11633 由steve02081504与Alex0125设计、编写
11634 转载时请在不对此文件做任何修改的同时注明出处
11635 项目地址:https://github.com/steve02081504/ELC
11636 */
11637
11638 //defs at "_defs.hpp"
11639
11640 #if defined(_MSC_VER)
11641 #pragma warning(pop)
11642 #endif
11643 #undef suppress_msvc_warning
11644 #undef disable_msvc_warning
11645 #undef push_msvc_warning
11646 #undef pop_msvc_warning
11647 #undef push_and_disable_msvc_warning
11648
11649 //for basic_environment.hpp
11650 #undef BIT_POSSIBILITY
11651 //
11652 #if defined(ELC_VOID_NAME)
11653 #define void the_void
11654 #endif
11655
11656 // #undef often_noexcept
11657 #undef noexcept_as
11658 #undef noexcept_as_auto
11659 #undef constexpr_as
11660 #undef constexpr_as_auto
11661
11662 #undef using_method_from_base_t
11663 #undef using_method_from_value
11664
11665 #undef floop
11666 #undef enable_adl
11667
11668 #undef re_declvalue
11669 #undef re_decltype
11670
11671 #undef declvalue
11672
11673 #undef template_error
11674 #undef template_warning
11675
11676 #undef type_info_of
11677 #undef type_name_of
11678
11679 #undef is_common_attribute
11680 #undef is_special_attribute
11681
11682 #undef has_attribute
11683 #undef not_has_attribute
11684
11685 #undef float_size_of
11686 #undef bitnum_of
11687
11688 #undef def_common_attribute_with_nothing
11689 #undef def_special_attribute_with_nothing
11690
11691 #undef common_attribute_t
11692 #undef special_attribute_t
11693
11694 #undef enable_if
11695 #undef enabled_by_default
11696 #undef disabled_by_default
11697 #undef enable_if_not_ill_form
11698 #undef enable_flag
11699
11700 #undef was_an_ill_form
11701 #undef was_an_ill_form_with_parameter
11702 #undef was_not_an_ill_form
11703 #undef was_not_an_ill_form_and_noexcept
11704 #undef was_not_an_ill_form_with_parameter
11705
11706 #undef recursive_lambda
11707 #undef get_recursive_lambda_caller
11708 #undef lambda
11709 #undef lambda_with_catch
11710 #undef self_recursion
11711 #undef lambda_RLSRRS
11712
11713 #undef MAGIC
11714
11715 #undef nothing
11716
11717 #undef elseif
11718 #undef _big_than_
11719 #undef _small_than_
11720
11721 #if defined(_MSC_VER)
11722 #undef not
11723 #undef and
11724 #undef or
11725 #endif
11726
11727 #undef INTER_NAMESPACE
11728 #undef BREAK_NAMESPACE
11729
11730 #undef szie
11731 #undef form
11732
11733 #undef template_name
11734 #undef type_name
11735
11736 #undef not_in_debug
11737
11738 #undef es
11739 #undef ec
11740
11741 #undef ELC_TEST_EVENTNAME
11742
11743 #undef override_instance_struct
11744
11745 #undef distinctive
11746
11747 #undef force_inline
11748
11749 #undef with_no_vtable
11750
11751 #undef in_consteval
11752
11753 #undef no_vtable_struct
11754 #undef no_vtable_class
11755
11756 //file_end
11757
11758 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11759
11760 //file_end
11761
11762 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11763 }
11764 namespace elc{
11765 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_export.hpp"
11766 //_export.hpp
11767 //at namespace elc
11768 /*
11769 未完成的elc解释器base_exception文件
11770 由steve02081504与Alex0125设计、编写
11771 转载时请在不对此文件做任何修改的同时注明出处
11772 项目地址:https://github.com/steve02081504/ELC
11773 */
11774 #define export using defs::exception_n::
11775 export exception;
11776 export runtime_exception;
11777 #undef export
11778
11779 //file_end
11780
11781 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11782 }
11783
11784 //file_end
11785
11786 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
11787 #endif
11788
11789 //file_end
11790
11791 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
11792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
11793 //base_stream
11794 //at namespace ::
11795 /*
11796 未完成的elc解释器include文件
11797 由steve02081504与Alex0125设计、编写
11798 转载时请在不对此文件做任何修改的同时注明出处
11799 项目地址:https://github.com/steve02081504/ELC
11800 */
11801 #if !defined(ELC_BASE_STREAM)
11802 #define ELC_BASE_STREAM
11803 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
11804 //_body.hpp
11805 //at namespace ::
11806 /*
11807 未完成的elc解释器base_stream文件
11808 由steve02081504与Alex0125设计、编写
11809 转载时请在不对此文件做任何修改的同时注明出处
11810 项目地址:https://github.com/steve02081504/ELC
11811 */
11812 #if defined(ELC_TEST)
11813 #error "this part cannot be tested."
11814 #endif
11815 namespace elc::defs{
11816 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
11817 //_defs.hpp
11818 /*
11819 未完成的elc解释器basic文件
11820 由steve02081504与Alex0125设计、编写
11821 转载时请在不对此文件做任何修改的同时注明出处
11822 项目地址:https://github.com/steve02081504/ELC
11823 */
11824 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11825 //_defs.hpp
11826 /*
11827 未完成的elc解释器_share文件
11828 由steve02081504与Alex0125设计、编写
11829 转载时请在不对此文件做任何修改的同时注明出处
11830 项目地址:https://github.com/steve02081504/ELC
11831 */
11832
11833 //undefs at "_undefs.hpp"
11834
11835 //set ELC_WARNING_LEVEL default to 4(max)
11836 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11837
11838 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
11839 //basic_environment.hpp
11840 /*
11841 未完成的elc解释器_share文件
11842 由steve02081504与Alex0125设计、编写
11843 转载时请在不对此文件做任何修改的同时注明出处
11844 项目地址:https://github.com/steve02081504/ELC
11845 */
11846
11847 //每个bit(不是字节)的可能性
11848 //为什么c艹委员会不定义这个?
11849 #define BIT_POSSIBILITY 2
11850
11851 //file_end
11852
11853 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11854
11855 #if defined(_MSC_VER)
11856 #pragma warning(push,ELC_WARNING_LEVEL)
11857 #pragma warning(disable:4099)//class与struct混用警告diss
11858 #pragma warning(disable:26812)//enum class安利diss.
11859 #pragma warning(disable:4584)//重复子类警告diss
11860 #pragma warning(disable:4250)//域控制继承警告diss
11861 #pragma warning(disable:26432)//不完全默认方法警告diss
11862 #pragma warning(disable:26435)//virtual override方法警告diss
11863 #pragma warning(disable:26481)//容器安利diss
11864 #pragma warning(disable:26446)//gsl::at安利diss
11865 #pragma warning(disable:26434)//方法覆盖警告diss
11866 #pragma warning(disable:26429)//gsl::not_null安利diss
11867 #pragma warning(disable:26471)//对void*进行static_cast安利diss
11868 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
11869 #pragma warning(disable:26473)//相同指针显式cast警告diss
11870 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
11871 #pragma warning(disable:26485)//数组作指针警告diss
11872 #pragma warning(disable:26490)//reinterpret_cast警告diss
11873 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
11874 #pragma warning(disable:26482)//非常数数组索引警告diss
11875 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
11876 #endif
11877 #if defined(_MSC_VER)
11878 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
11879 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
11880 #define push_msvc_warning() __pragma(warning(push))
11881 #define pop_msvc_warning() __pragma(warning(pop))
11882 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
11883 #else
11884 #define suppress_msvc_warning(...)
11885 #define disable_msvc_warning(...)
11886 #define push_msvc_warning()
11887 #define pop_msvc_warning()
11888 #define push_and_disable_msvc_warning(...)
11889 #endif
11890 //
11891 #if defined(ELC_VOID_NAME)
11892 #undef void
11893 #endif
11894
11895 // #define often_noexcept
11896 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
11897 #define noexcept_as_auto MAGIC//哦现在有了
11898 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
11899 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
11900
11901 #define using_method_from_base_t(name,...) \
11902 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
11903 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
11904 {\
11905 return base_t::name(forward<Args>(rest)...);\
11906 }\
11907
11908 #define using_method_from_value(name,value_name,...) \
11909 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
11910 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
11911 {\
11912 return value_name.name(forward<Args>(rest)...);\
11913 }\
11914
11915 #define floop while(__builtin_is_my_dick_still_there())
11916 #define enable_adl(name) void name()noexcept=delete
11917
11918 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
11919 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
11920
11921 #define declvalue(...) (::std::declval<__VA_ARGS__>())
11922
11923 /*实例化到此将引发错误*/
11924 #define template_error(reason) static_assert(template_error_helper<T>,reason)
11925 /*实例化到此将引发警告*/
11926 #define template_warning(reason) template_warning_helper<T>(reason)
11927
11928 //for type_info
11929 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
11930 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
11931
11932 #define is_common_attribute(name) public attribute<T,name<T>>
11933 #define is_special_attribute(name) public attribute<T,name>
11934
11935 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
11936 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
11937
11938 //for float_size_t
11939 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
11940 //bitnum_of
11941 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
11942
11943 //for attribute
11944 #define def_common_attribute_with_nothing(name) \
11945 template<typename T>\
11946 class name{}\
11947
11948 #define def_special_attribute_with_nothing(name) \
11949 class name{}\
11950
11951 #define common_attribute_t template<class>class
11952 #define special_attribute_t class
11953
11954 /*
11955 若参数的布尔值为零,那么此模板不会实例化
11956
11957 为什么不用cpp20的constraints?
11958 1.不能类内定义
11959 2.不能作为模板参数
11960 一句话总结:c艹标准会sb
11961 */
11962 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
11963 /*默认参与模板候选*/
11964 #define enabled_by_default class enable_state=void
11965 /*默认不参与模板候选*/
11966 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
11967 /*若参数为病式,那么此模板不会实例化*/
11968 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
11969 /*用于模板声明*/
11970 #define enable_flag class enable_state
11971
11972 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
11973 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
11974 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
11975 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
11976 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
11977
11978 /*让lambda递归更加美观*/
11979 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
11980 /*让lambda递归更加美观*/
11981 #define get_recursive_lambda_caller(name) \
11982 lambda_with_catch(&)(auto&&...Args){\
11983 return name(name,Args...);\
11984 }
11985 /*让lambda定义更加美观*/
11986 #define lambda []
11987 /*让lambda定义更加美观*/
11988 #define lambda_with_catch(...) [__VA_ARGS__]
11989 /*让lambda递归更加美观*/
11990 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
11991 //recursive_lambda_self_referential_reserved_symbolname
11992 #define lambda_RLSRRS _my_jb_super_sb_name_
11993
11994 #define MAGIC//ahh,ko no tenno da!
11995
11996 /*装饰性语法糖*/
11997 #define nothing
11998
11999 /*aya风格语法糖*/
12000 #define elseif else if
12001 /*aya风格语法糖*/
12002 #define _big_than_ >
12003 /*aya风格语法糖*/
12004 #define _small_than_ <
12005
12006 #if defined(_MSC_VER)
12007 #define not !
12008 #define and &&
12009 #define or ||
12010 #endif
12011
12012 /*进入名称空间,并不是很美观*/
12013 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
12014 /*退出名称空间,并不是很美观*/
12015 #define BREAK_NAMESPACE }
12016
12017 /*template说明符*/
12018 #define template_name template
12019 /*template说明符*/
12020 #define type_name class
12021
12022 #if defined(DEBUG) || defined(_DEBUG)
12023 #define not_in_debug 0
12024 #else
12025 #define not_in_debug 1
12026 #endif
12027
12028 #define es U""
12029 #define ec(ch) U ## ch
12030
12031 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
12032 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
12033 #else
12034 #define ELC_TEST_EVENTNAME(name)
12035 #endif
12036
12037 #define override_instance_struct \
12038 protected:\
12039 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
12040 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
12041 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
12042 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
12043 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
12044
12045 #if defined(_WIN32)
12046 #define distinctive __declspec(dllexport)
12047 #else
12048 #define distinctive
12049 #endif
12050
12051 #if defined(_WIN32)
12052 #define force_inline __forceinline
12053 #elif defined(__GNUC__)
12054 #define force_inline __attribute__((always_inline)) inline
12055 #else
12056 #define force_inline inline
12057 #endif
12058
12059 #if defined(_WIN32)
12060 #define with_no_vtable __declspec(novtable)
12061 #else
12062 #define with_no_vtable
12063 #endif
12064
12065 #define in_consteval (::std::is_constant_evaluated())
12066
12067 #define no_vtable_struct struct with_no_vtable
12068 #define no_vtable_class class with_no_vtable
12069
12070 //file_end
12071
12072 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
12073
12074 //file_end
12075
12076 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12077
12078 namespace stream_n{
12079 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/base_streams/_body.hpp"
12080 //_body.hpp
12081 //at namespace elc
12082 /*
12083 未完成的elc解释器base_stream文件
12084 由steve02081504与Alex0125设计、编写
12085 转载时请在不对此文件做任何修改的同时注明出处
12086 项目地址:https://github.com/steve02081504/ELC
12087 */
12091 virtual ~base_stream()=default;
12092 virtual void*seek(seek_type,int_t)=0;
12093 virtual void*tell(){return this->seek(cur,0);}
12094 virtual void seek_to(void*)=0;
12095 virtual void sync()=0;
12096 virtual void flush()=0;
12097 virtual void close()=0;
12098 };
12100 virtual ~base_ostream()=default;
12101 virtual void write(const byte*buf,size_t size)=0;
12102 template<class T>
12103 void write(const T*v,size_t size=1){
12104 this->write(cast_to_data(v),size*sizeof(T));
12105 }
12106 };
12108 virtual ~base_istream()=default;
12109 virtual size_t read(byte*buf,size_t size)=0;
12110 template<class T>
12111 size_t read(T*v,size_t size=1){
12112 return this->read(cast_to_data(v),size*sizeof(T))/sizeof(T);
12113 }
12114 };
12116
12117
12119 virtual ~noexcept_stream()noexcept override=default;
12120 virtual void*seek(seek_type,int_t)noexcept override=0;
12121 virtual void*tell()noexcept override{return this->seek(cur,0);}
12122 virtual void seek_to(void*)noexcept override=0;
12123 virtual void sync()noexcept override=0;
12124 virtual void flush()noexcept override=0;
12125 virtual void close()noexcept override=0;
12126 };
12128 virtual void write(const byte*buf,size_t size)noexcept override=0;
12129 template<class T>
12130 void write(const T*v,size_t size=1)noexcept{
12131 this->write(cast_to_data(v),size*sizeof(T));
12132 }
12133 };
12135 virtual size_t read(byte*buf,size_t size)noexcept override=0;
12136 template<class T>
12137 size_t read(T*v,size_t size=1)noexcept{
12138 return this->read(cast_to_data(v),size*sizeof(T))/sizeof(T);
12139 }
12140 };
12142 static_assert(noexcept(((noexcept_iostream*)(nullptr))->~noexcept_iostream()));
12143 static_assert(noexcept(((noexcept_iostream*)(nullptr))->sync()));
12144
12145 //string streams
12149 //noexcept_
12153
12154
12155 //data streams
12159 //noexcept_
12163
12165
12166 //file_end
12167
12168 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12169 }
12170 using namespace stream_n;
12171
12172 #if defined(ELC_TEST_ON)
12173 namespace base_stream_part_test{
12174 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_test.hpp"
12175 //_test.hpp
12176 /*
12177 未完成的elc解释器base_stream文件
12178 由steve02081504与Alex0125设计、编写
12179 转载时请在不对此文件做任何修改的同时注明出处
12180 项目地址:https://github.com/steve02081504/ELC
12181 */
12182 inline void test(){
12183 ELC_TEST_EVENTNAME("base_stream部分测试");
12184 }
12185 inline void test_log_out(){
12186 }
12187 inline void test_end(){
12188 }
12189
12190 //file_end
12191
12192 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12193 }
12194 #endif
12195
12196 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
12197 //_undefs.hpp
12198 /*
12199 未完成的elc解释器basic文件
12200 由steve02081504与Alex0125设计、编写
12201 转载时请在不对此文件做任何修改的同时注明出处
12202 项目地址:https://github.com/steve02081504/ELC
12203 */
12204 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
12205 //_undefs.hpp
12206 /*
12207 未完成的elc解释器_share文件
12208 由steve02081504与Alex0125设计、编写
12209 转载时请在不对此文件做任何修改的同时注明出处
12210 项目地址:https://github.com/steve02081504/ELC
12211 */
12212
12213 //defs at "_defs.hpp"
12214
12215 #if defined(_MSC_VER)
12216 #pragma warning(pop)
12217 #endif
12218 #undef suppress_msvc_warning
12219 #undef disable_msvc_warning
12220 #undef push_msvc_warning
12221 #undef pop_msvc_warning
12222 #undef push_and_disable_msvc_warning
12223
12224 //for basic_environment.hpp
12225 #undef BIT_POSSIBILITY
12226 //
12227 #if defined(ELC_VOID_NAME)
12228 #define void the_void
12229 #endif
12230
12231 // #undef often_noexcept
12232 #undef noexcept_as
12233 #undef noexcept_as_auto
12234 #undef constexpr_as
12235 #undef constexpr_as_auto
12236
12237 #undef using_method_from_base_t
12238 #undef using_method_from_value
12239
12240 #undef floop
12241 #undef enable_adl
12242
12243 #undef re_declvalue
12244 #undef re_decltype
12245
12246 #undef declvalue
12247
12248 #undef template_error
12249 #undef template_warning
12250
12251 #undef type_info_of
12252 #undef type_name_of
12253
12254 #undef is_common_attribute
12255 #undef is_special_attribute
12256
12257 #undef has_attribute
12258 #undef not_has_attribute
12259
12260 #undef float_size_of
12261 #undef bitnum_of
12262
12263 #undef def_common_attribute_with_nothing
12264 #undef def_special_attribute_with_nothing
12265
12266 #undef common_attribute_t
12267 #undef special_attribute_t
12268
12269 #undef enable_if
12270 #undef enabled_by_default
12271 #undef disabled_by_default
12272 #undef enable_if_not_ill_form
12273 #undef enable_flag
12274
12275 #undef was_an_ill_form
12276 #undef was_an_ill_form_with_parameter
12277 #undef was_not_an_ill_form
12278 #undef was_not_an_ill_form_and_noexcept
12279 #undef was_not_an_ill_form_with_parameter
12280
12281 #undef recursive_lambda
12282 #undef get_recursive_lambda_caller
12283 #undef lambda
12284 #undef lambda_with_catch
12285 #undef self_recursion
12286 #undef lambda_RLSRRS
12287
12288 #undef MAGIC
12289
12290 #undef nothing
12291
12292 #undef elseif
12293 #undef _big_than_
12294 #undef _small_than_
12295
12296 #if defined(_MSC_VER)
12297 #undef not
12298 #undef and
12299 #undef or
12300 #endif
12301
12302 #undef INTER_NAMESPACE
12303 #undef BREAK_NAMESPACE
12304
12305 #undef szie
12306 #undef form
12307
12308 #undef template_name
12309 #undef type_name
12310
12311 #undef not_in_debug
12312
12313 #undef es
12314 #undef ec
12315
12316 #undef ELC_TEST_EVENTNAME
12317
12318 #undef override_instance_struct
12319
12320 #undef distinctive
12321
12322 #undef force_inline
12323
12324 #undef with_no_vtable
12325
12326 #undef in_consteval
12327
12328 #undef no_vtable_struct
12329 #undef no_vtable_class
12330
12331 //file_end
12332
12333 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
12334
12335 //file_end
12336
12337 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12338 }
12339 namespace elc{
12340 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_export.hpp"
12341 //_export.hpp
12342 //at namespace elc
12343 /*
12344 未完成的elc解释器base_stream文件
12345 由steve02081504与Alex0125设计、编写
12346 转载时请在不对此文件做任何修改的同时注明出处
12347 项目地址:https://github.com/steve02081504/ELC
12348 */
12349 #define export using defs::
12350 export base_stream;
12351 export base_ostream;
12352 export base_istream;
12353 export base_iostream;
12354 export noexcept_stream;
12355 export noexcept_ostream;
12356 export noexcept_istream;
12357 export noexcept_iostream;
12358 #undef export
12359
12360 //file_end
12361
12362 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12363 }
12364
12365 //file_end
12366
12367 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
12368 #endif
12369
12370 //file_end
12371
12372 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
12373 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12374 //core
12375 //at namespace ::
12376 /*
12377 未完成的elc解释器include文件
12378 由steve02081504与Alex0125设计、编写
12379 转载时请在不对此文件做任何修改的同时注明出处
12380 项目地址:https://github.com/steve02081504/ELC
12381 */
12382 #if !defined(ELC_CORE)
12383 #define ELC_CORE
12384 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
12385 //base
12386 //at namespace ::
12387 /*
12388 未完成的elc解释器include文件
12389 由steve02081504与Alex0125设计、编写
12390 转载时请在不对此文件做任何修改的同时注明出处
12391 项目地址:https://github.com/steve02081504/ELC
12392 */
12393 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
12394
12395 //file_end
12396
12397 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12398 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
12399 //base_exception
12400 //at namespace ::
12401 /*
12402 未完成的elc解释器include文件
12403 由steve02081504与Alex0125设计、编写
12404 转载时请在不对此文件做任何修改的同时注明出处
12405 项目地址:https://github.com/steve02081504/ELC
12406 */
12407 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
12408
12409 //file_end
12410
12411 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12412 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
12413 //base_stream
12414 //at namespace ::
12415 /*
12416 未完成的elc解释器include文件
12417 由steve02081504与Alex0125设计、编写
12418 转载时请在不对此文件做任何修改的同时注明出处
12419 项目地址:https://github.com/steve02081504/ELC
12420 */
12421 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
12422
12423 //file_end
12424
12425 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12426 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
12427 //_body.hpp
12428 //at namespace ::
12429 /*
12430 未完成的elc解释器core文件
12431 由steve02081504与Alex0125设计、编写
12432 转载时请在不对此文件做任何修改的同时注明出处
12433 项目地址:https://github.com/steve02081504/ELC
12434 */
12435 #if defined(ELC_TEST)
12436 #error "this part cannot be tested."
12437 #endif
12438 namespace elc::defs{
12439 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
12440 //_defs.hpp
12441 /*
12442 未完成的elc解释器basic文件
12443 由steve02081504与Alex0125设计、编写
12444 转载时请在不对此文件做任何修改的同时注明出处
12445 项目地址:https://github.com/steve02081504/ELC
12446 */
12447 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
12448 //_defs.hpp
12449 /*
12450 未完成的elc解释器_share文件
12451 由steve02081504与Alex0125设计、编写
12452 转载时请在不对此文件做任何修改的同时注明出处
12453 项目地址:https://github.com/steve02081504/ELC
12454 */
12455
12456 //undefs at "_undefs.hpp"
12457
12458 //set ELC_WARNING_LEVEL default to 4(max)
12459 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
12460
12461 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
12462 //basic_environment.hpp
12463 /*
12464 未完成的elc解释器_share文件
12465 由steve02081504与Alex0125设计、编写
12466 转载时请在不对此文件做任何修改的同时注明出处
12467 项目地址:https://github.com/steve02081504/ELC
12468 */
12469
12470 //每个bit(不是字节)的可能性
12471 //为什么c艹委员会不定义这个?
12472 #define BIT_POSSIBILITY 2
12473
12474 //file_end
12475
12476 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
12477
12478 #if defined(_MSC_VER)
12479 #pragma warning(push,ELC_WARNING_LEVEL)
12480 #pragma warning(disable:4099)//class与struct混用警告diss
12481 #pragma warning(disable:26812)//enum class安利diss.
12482 #pragma warning(disable:4584)//重复子类警告diss
12483 #pragma warning(disable:4250)//域控制继承警告diss
12484 #pragma warning(disable:26432)//不完全默认方法警告diss
12485 #pragma warning(disable:26435)//virtual override方法警告diss
12486 #pragma warning(disable:26481)//容器安利diss
12487 #pragma warning(disable:26446)//gsl::at安利diss
12488 #pragma warning(disable:26434)//方法覆盖警告diss
12489 #pragma warning(disable:26429)//gsl::not_null安利diss
12490 #pragma warning(disable:26471)//对void*进行static_cast安利diss
12491 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
12492 #pragma warning(disable:26473)//相同指针显式cast警告diss
12493 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
12494 #pragma warning(disable:26485)//数组作指针警告diss
12495 #pragma warning(disable:26490)//reinterpret_cast警告diss
12496 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
12497 #pragma warning(disable:26482)//非常数数组索引警告diss
12498 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
12499 #endif
12500 #if defined(_MSC_VER)
12501 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
12502 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
12503 #define push_msvc_warning() __pragma(warning(push))
12504 #define pop_msvc_warning() __pragma(warning(pop))
12505 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
12506 #else
12507 #define suppress_msvc_warning(...)
12508 #define disable_msvc_warning(...)
12509 #define push_msvc_warning()
12510 #define pop_msvc_warning()
12511 #define push_and_disable_msvc_warning(...)
12512 #endif
12513 //
12514 #if defined(ELC_VOID_NAME)
12515 #undef void
12516 #endif
12517
12518 // #define often_noexcept
12519 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
12520 #define noexcept_as_auto MAGIC//哦现在有了
12521 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
12522 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
12523
12524 #define using_method_from_base_t(name,...) \
12525 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
12526 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
12527 {\
12528 return base_t::name(forward<Args>(rest)...);\
12529 }\
12530
12531 #define using_method_from_value(name,value_name,...) \
12532 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
12533 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
12534 {\
12535 return value_name.name(forward<Args>(rest)...);\
12536 }\
12537
12538 #define floop while(__builtin_is_my_dick_still_there())
12539 #define enable_adl(name) void name()noexcept=delete
12540
12541 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
12542 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
12543
12544 #define declvalue(...) (::std::declval<__VA_ARGS__>())
12545
12546 /*实例化到此将引发错误*/
12547 #define template_error(reason) static_assert(template_error_helper<T>,reason)
12548 /*实例化到此将引发警告*/
12549 #define template_warning(reason) template_warning_helper<T>(reason)
12550
12551 //for type_info
12552 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
12553 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
12554
12555 #define is_common_attribute(name) public attribute<T,name<T>>
12556 #define is_special_attribute(name) public attribute<T,name>
12557
12558 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
12559 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
12560
12561 //for float_size_t
12562 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
12563 //bitnum_of
12564 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
12565
12566 //for attribute
12567 #define def_common_attribute_with_nothing(name) \
12568 template<typename T>\
12569 class name{}\
12570
12571 #define def_special_attribute_with_nothing(name) \
12572 class name{}\
12573
12574 #define common_attribute_t template<class>class
12575 #define special_attribute_t class
12576
12577 /*
12578 若参数的布尔值为零,那么此模板不会实例化
12579
12580 为什么不用cpp20的constraints?
12581 1.不能类内定义
12582 2.不能作为模板参数
12583 一句话总结:c艹标准会sb
12584 */
12585 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
12586 /*默认参与模板候选*/
12587 #define enabled_by_default class enable_state=void
12588 /*默认不参与模板候选*/
12589 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
12590 /*若参数为病式,那么此模板不会实例化*/
12591 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
12592 /*用于模板声明*/
12593 #define enable_flag class enable_state
12594
12595 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
12596 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
12597 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
12598 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
12599 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
12600
12601 /*让lambda递归更加美观*/
12602 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
12603 /*让lambda递归更加美观*/
12604 #define get_recursive_lambda_caller(name) \
12605 lambda_with_catch(&)(auto&&...Args){\
12606 return name(name,Args...);\
12607 }
12608 /*让lambda定义更加美观*/
12609 #define lambda []
12610 /*让lambda定义更加美观*/
12611 #define lambda_with_catch(...) [__VA_ARGS__]
12612 /*让lambda递归更加美观*/
12613 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
12614 //recursive_lambda_self_referential_reserved_symbolname
12615 #define lambda_RLSRRS _my_jb_super_sb_name_
12616
12617 #define MAGIC//ahh,ko no tenno da!
12618
12619 /*装饰性语法糖*/
12620 #define nothing
12621
12622 /*aya风格语法糖*/
12623 #define elseif else if
12624 /*aya风格语法糖*/
12625 #define _big_than_ >
12626 /*aya风格语法糖*/
12627 #define _small_than_ <
12628
12629 #if defined(_MSC_VER)
12630 #define not !
12631 #define and &&
12632 #define or ||
12633 #endif
12634
12635 /*进入名称空间,并不是很美观*/
12636 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
12637 /*退出名称空间,并不是很美观*/
12638 #define BREAK_NAMESPACE }
12639
12640 /*template说明符*/
12641 #define template_name template
12642 /*template说明符*/
12643 #define type_name class
12644
12645 #if defined(DEBUG) || defined(_DEBUG)
12646 #define not_in_debug 0
12647 #else
12648 #define not_in_debug 1
12649 #endif
12650
12651 #define es U""
12652 #define ec(ch) U ## ch
12653
12654 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
12655 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
12656 #else
12657 #define ELC_TEST_EVENTNAME(name)
12658 #endif
12659
12660 #define override_instance_struct \
12661 protected:\
12662 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
12663 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
12664 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
12665 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
12666 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
12667
12668 #if defined(_WIN32)
12669 #define distinctive __declspec(dllexport)
12670 #else
12671 #define distinctive
12672 #endif
12673
12674 #if defined(_WIN32)
12675 #define force_inline __forceinline
12676 #elif defined(__GNUC__)
12677 #define force_inline __attribute__((always_inline)) inline
12678 #else
12679 #define force_inline inline
12680 #endif
12681
12682 #if defined(_WIN32)
12683 #define with_no_vtable __declspec(novtable)
12684 #else
12685 #define with_no_vtable
12686 #endif
12687
12688 #define in_consteval (::std::is_constant_evaluated())
12689
12690 #define no_vtable_struct struct with_no_vtable
12691 #define no_vtable_class class with_no_vtable
12692
12693 //file_end
12694
12695 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
12696
12697 //file_end
12698
12699 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
12700
12701 namespace core{
12702 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12703 //_body.hpp
12704 //at namespace elc::defs::core
12705 /*
12706 未完成的elc解释器base文件
12707 由steve02081504与Alex0125设计、编写
12708 转载时请在不对此文件做任何修改的同时注明出处
12709 项目地址:https://github.com/steve02081504/ELC
12710 */
12711 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/decl.hpp"
12712 //decl.hpp
12713 //at namespace elc::defs::core
12714 /*
12715 未完成的elc解释器core文件
12716 由steve02081504与Alex0125设计、编写
12717 转载时请在不对此文件做任何修改的同时注明出处
12718 项目地址:https://github.com/steve02081504/ELC
12719 */
12720 struct node_like;
12721 typedef comn_ptr_t<node_like>ptr;
12722 typedef weak_ptr_t<node_like>weak_ptr;
12723 typedef comn_ptr_t<const node_like>const_ptr;
12724 typedef weak_ptr_t<const node_like>const_weak_ptr;
12725 struct value;
12726
12728 namespace string_n{
12729 template<typename char_T>
12730 struct string_t;
12732 }
12733 using string_n::string_t;
12734 using string_n::string;
12735 template<constexpr_str_n::constexpr_str_t_literal_helper str_helper>
12736 inline constexpr string operator""_elc_string()noexcept;
12737 INTER_NAMESPACE(core)
12738
12739 template<typename T>
12740 [[nodiscard]]inline ptr make_long_term_binary_node_from(T a)noexcept;
12741
12742 template<typename T>
12743 constexpr bool as_ptr_nothrow_helper()noexcept{
12744 if constexpr(was_not_an_ill_form(ptr(&declvalue(T))))
12745 return noexcept(ptr(&declvalue(T)));
12747 return noexcept(const_ptr(&declvalue(T)));
12748 elseif constexpr(was_not_an_ill_form(static_cast<node_like&>(declvalue(T))))
12749 return noexcept(&static_cast<node_like&>(declvalue(T)));
12750 elseif constexpr(was_not_an_ill_form(static_cast<const node_like&>(declvalue(T))))
12751 return noexcept(&static_cast<const node_like&>(declvalue(T)));
12752 elseif constexpr(was_not_an_ill_form(static_cast<value&>(declvalue(T))))
12753 return noexcept(ptr(static_cast<value&>(declvalue(T))));
12754 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(declvalue(T))))
12755 return noexcept(const_ptr(static_cast<value&>(declvalue(T))));
12756 elseif constexpr(was_not_an_ill_form(ptr(declvalue(T))))
12757 return noexcept(ptr(declvalue(T)));
12759 return noexcept(const_ptr(declvalue(T)));
12760 elseif constexpr(type_info<remove_cvref<T>> == type_info<char_t>)
12761 return noexcept(make_long_term_binary_node_from<char_t>(declvalue(T)));
12762 elseif constexpr(::std::is_integral_v<remove_cvref<T>>){
12763 if constexpr(::std::is_signed_v<remove_cvref<T>>)
12764 return noexcept(make_long_term_binary_node_from<int_t>(declvalue(T)));
12765 else
12766 return noexcept(make_long_term_binary_node_from<uint_t>(declvalue(T)));
12767 }
12768 elseif constexpr(::std::is_floating_point_v<remove_cvref<T>>)
12769 return noexcept(make_long_term_binary_node_from<float_t>(declvalue(T)));
12770 elseif constexpr(construct<string>.able<T>){
12771 return noexcept(make_long_term_binary_node_from<string>(declvalue(T)));
12772 }
12773 }
12774 template<typename T>
12775 decltype(auto) as_ptr(T&&a)noexcept(as_ptr_nothrow_helper<T>()){
12776 ELC_TEST_EVENTNAME("as_ptr转换");
12777 if constexpr(was_not_an_ill_form(ptr(&a)))
12778 return ptr(&a);
12779 elseif constexpr(was_not_an_ill_form(const_ptr(&a)))
12780 return const_ptr(&a);
12781 elseif constexpr(was_not_an_ill_form(static_cast<node_like&>(a)))
12782 return &static_cast<node_like&>(a);
12783 elseif constexpr(was_not_an_ill_form(static_cast<const node_like&>(a)))
12784 return &static_cast<const node_like&>(a);
12785 elseif constexpr(was_not_an_ill_form(static_cast<value&>(a)))
12786 return ptr(static_cast<value&>(a));
12787 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(a)))
12788 return const_ptr(static_cast<value&>(a));
12789 elseif constexpr(was_not_an_ill_form(ptr(a)))
12790 return ptr(a);
12791 elseif constexpr(was_not_an_ill_form(const_ptr(a)))
12792 return const_ptr(a);
12793 elseif constexpr(type_info<remove_cvref<T>> == type_info<char_t>)
12794 return make_long_term_binary_node_from<char_t>(a);
12795 elseif constexpr(::std::is_integral_v<remove_cvref<T>>){
12796 if constexpr(::std::is_signed_v<remove_cvref<T>>)
12797 return make_long_term_binary_node_from<int_t>(a);
12798 else
12799 return make_long_term_binary_node_from<uint_t>(a);
12800 }
12801 elseif constexpr(::std::is_floating_point_v<remove_cvref<T>>)
12802 return make_long_term_binary_node_from<float_t>(a);
12803 elseif constexpr(construct<string>.able<T>){
12804 return make_long_term_binary_node_from<string>(a);
12805 }
12806 }
12807
12808 template<typename T>
12809 constexpr bool as_value_nothrow_helper()noexcept{
12810 if constexpr(was_not_an_ill_form(static_cast<value&>(declvalue(T))))
12811 return noexcept(static_cast<value&>(declvalue(T)));
12812 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(declvalue(T))))
12813 return noexcept(static_cast<const value&>(declvalue(T)));
12815 if constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<ptr>)
12816 return noexcept(value(as_ptr(declvalue(T))));
12817 elseif constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<const_ptr>)
12818 return noexcept((const value)remove_const((const node_like*)as_ptr(declvalue(T))));
12819 }
12820 }
12821 template<typename T>
12822 decltype(auto) as_value(T&& a)noexcept(as_value_nothrow_helper<T>()){
12823 ELC_TEST_EVENTNAME("as_value转换");
12824 if constexpr(was_not_an_ill_form(static_cast<value&>(a)))
12825 return static_cast<value&>(a);
12826 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(a)))
12827 return static_cast<const value&>(a);
12829 if constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<ptr>)
12830 return value(as_ptr(forward<T>(a)));
12831 elseif constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<const_ptr>)
12832 return (const value)remove_const((const node_like*)as_ptr(forward<T>(a)));
12833 }
12834 }
12835
12836 //file_end
12837
12838 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12839
12840 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/node_like.hpp"
12841 //defs.hpp
12842 //at namespace elc::defs::core
12843 /*
12844 未完成的elc解释器core文件
12845 由steve02081504与Alex0125设计、编写
12846 转载时请在不对此文件做任何修改的同时注明出处
12847 项目地址:https://github.com/steve02081504/ELC
12848 */
12849 [[nodiscard]]inline ptr make_list()noexcept;
12850 template<typename T,typename...Args>
12851 [[nodiscard]]inline ptr make_list(T&&first,Args&&...rest);
12852
12854 with_common_attribute<abstract_base,weak_ref_able,replace_able,ref_able>{
12855 public:
12857
12858 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept=0;
12859
12860 [[nodiscard]]virtual value be_eval();
12861 [[nodiscard]]virtual value be_call(ptr);
12862 protected:
12863 [[nodiscard]]virtual logical_bool equal_with(const_ptr)const noexcept=0;
12864 [[nodiscard]]virtual logical_bool eq_with(const_ptr a)const noexcept{return a.get()==this;}//不是a==this:ptr的opertaor==将调用在下方定义的pointer_equal,这会通过eq间接调用eq_with
12865 [[nodiscard]]virtual constexpr size_t equal_level()const noexcept{return 36;}
12866 [[nodiscard]]virtual constexpr size_t eq_level()const noexcept{return 36;}
12867 public:
12868 node_like()noexcept=default;
12869 node_like(never_ref_num_zero_t)noexcept{ attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero(); }
12870 virtual ~node_like()=default;
12871
12872 [[nodiscard]]virtual value arec(const value)=0;
12873
12874 [[nodiscard]]value operator[](const value index);
12875 [[nodiscard]]value operator[](auto&&index){
12876 return operator[](as_value(index));
12877 }
12878
12879 virtual void clear()noexcept=0;
12880
12881 [[nodiscard]]virtual explicit operator hash_t()const noexcept{return hash((void*)this);}
12882 void destroy()noexcept{
12883 this->be_replace_as(null_ptr);
12884 }
12885 virtual void be_replace_as(ptr a)noexcept{
12886 this->clear();
12888 }
12889
12890 [[nodiscard]]virtual explicit operator logical_bool()const noexcept{return true;}
12891 [[nodiscard]]explicit operator bool()const noexcept{return(bool)this->operator logical_bool();}
12892
12893 template<typename...Args>
12894 inline value operator()(Args&&...rest){return this->be_call(make_list(forward<Args>(rest)...));}
12895
12896 [[nodiscard]]logical_bool eq(const_ptr a)const noexcept{
12897 const auto this_eqlv = this->eq_level();
12898 const auto arg_eqlv = a->eq_level();
12899 if(this_eqlv _small_than_ arg_eqlv)
12900 return a->eq_with(this);
12901 elseif(this_eqlv _big_than_ arg_eqlv)
12902 return this->eq_with(a);
12903 else
12904 return this->eq_with(a)&&a->eq_with(this);
12905 }
12906 [[nodiscard]]logical_bool equal(const_ptr a)const noexcept{
12907 const auto this_equlv = this->equal_level();
12908 const auto arg_equlv = a->equal_level();
12909 if(this_equlv _small_than_ arg_equlv)
12910 return a->equal_with(this);
12911 elseif(this_equlv _big_than_ arg_equlv)
12912 return this->equal_with(a);
12913 else
12914 return this->equal_with(a)&&a->equal_with(this);
12915 }
12916
12917 [[nodiscard]]ptr operator&()noexcept{return this;}
12918 [[nodiscard]]const_ptr operator&()const noexcept{return this;}
12919 [[nodiscard]]logical_bool operator==(const this_t&a)const noexcept{
12920 return a.equal(this);
12921 }
12922 protected:
12923 friend void the_waiting_for_destroy(node_like* a)noexcept;
12924 virtual void waiting_for_destroy()noexcept{clear();}
12925 };
12926
12927 //base中的类型功能适应器
12928 [[nodiscard]]inline constexpr node_like*the_get_null_ptr(const node_like*)noexcept;//{return&void;}
12929 [[nodiscard]]inline logical_bool the_pointer_to_bool(const node_like*a)noexcept{
12930 return a->operator logical_bool();
12931 }
12932 [[nodiscard]]inline logical_bool the_pointer_equal(const node_like*a,const node_like*b)noexcept{
12933 return a->eq(b);
12934 }
12935 [[nodiscard]]inline hash_t the_pointer_hash(const node_like*a)noexcept{
12936 return a->operator hash_t();
12937 }
12938 //ptr中的类型功能适应器
12939 inline void the_waiting_for_destroy(node_like*a)noexcept{
12940 a->waiting_for_destroy();
12941 }
12942 inline void the_destroy_and_free(node_like*a)noexcept{
12943 unget(a);
12944 }
12945
12946 //gc中的类型功能适应器
12947 inline void the_destroy(node_like*a)noexcept{
12948 a->destroy();
12949 }
12950
12951 //file_end
12952
12953 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12954 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/ptr.hpp"
12955 //def.hpp
12956 //at namespace elc::defs::core
12957 /*
12958 未完成的elc解释器core文件
12959 由steve02081504与Alex0125设计、编写
12960 转载时请在不对此文件做任何修改的同时注明出处
12961 项目地址:https://github.com/steve02081504/ELC
12962 */
12963 typedef comn_ptr_t<node_like>ptr;
12964 typedef weak_ptr_t<node_like>weak_ptr;
12965 typedef comn_ptr_t<const node_like>const_ptr;
12966 typedef weak_ptr_t<const node_like>const_weak_ptr;
12967
12968 //file_end
12969
12970 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12971 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/value.hpp"
12972 //value.hpp
12973 //at namespace elc::defs::core
12974 /*
12975 未完成的elc解释器core文件
12976 由steve02081504与Alex0125设计、编写
12977 转载时请在不对此文件做任何修改的同时注明出处
12978 项目地址:https://github.com/steve02081504/ELC
12979 */
12981 typedef value this_t;
12983 with_common_attribute<abstract_base,ref_able,never_in_array,replace_able>,
12985 /*//COMMIT:
12986 是否应当支持value data的引用计数?
12987 否的原因:
12988 这将导致应当对value的data加入gc机制(否则容易出现闭环value垃圾!)
12989 而这将严重增加elc的运行时时空负担
12990 有人可能得到递归引用的value
12991 是的原因:
12992 防御式编程
12993 更佳多样的value实现
12994 引用计数以降低value的复制开销
12995 对否定想法的驳回:
12996 严重增加elc的运行时时空负担?:value的复制开销可能更大
12997 有人可能得到递归引用的value?这将导致应当对value的data加入gc机制?:
12998 没见哪个语言不允许写while(true)
12999 自定义value的应该都是聪明人,如果真的会出现循环引用那他们自己解决就好
13000 总结:
13001 加引用计数,但不加gc
13002 elc的设计理念包括“不应禁止用户做什么”,所以应当提供高自由度的value定制可能
13003 但出于性能考虑,不加gc
13004 如果真的有需要gc解决的value data那么让那聪明的设计者自己给自己的data类加gc解决这种问题就好
13005 */
13006 base_data_t()noexcept=default;
13007 base_data_t(never_ref_num_zero_t)noexcept{ attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero(); }
13008 virtual ~base_data_t()noexcept=default;
13009
13010 virtual void be_set(ptr)=0;
13011 [[nodiscard]]virtual ptr get_value()=0;
13012 [[nodiscard]]virtual base_data_t*copy()const noexcept=0;
13013 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept=0;//为什么要加这个?我不知道,万一将来有人用上了呢?
13014 };
13015
13016 distinctive inline static struct null_data_t final:instance_struct<null_data_t>
13018 null_data_t()noexcept:value::base_data_t(never_ref_num_zero){}
13019 virtual ~null_data_t()noexcept override final=default;
13020
13021 virtual void be_set(ptr a)noexcept override final{}
13022 [[nodiscard]]virtual ptr get_value()noexcept override final{return null_ptr;}
13023 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return remove_const(this);}
13024 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<null_data_t>;}
13025 }null_data{};
13026
13027 struct constexpr_data_t final:instance_struct<constexpr_data_t>
13028 ,base_data_t{
13030 constexpr_data_t(ptr a)noexcept:_m(a){}
13031 constexpr_data_t(const constexpr_data_t&)noexcept=default;
13032 virtual ~constexpr_data_t()noexcept override final=default;
13033
13034 virtual void be_set(ptr)noexcept override final{}
13035 [[nodiscard]]virtual ptr get_value()noexcept override final{return _m;}
13036 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<constexpr_data_t>(_m);}
13037 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<constexpr_data_t>;}
13038 };
13039
13040 struct variable_data_t final:instance_struct<variable_data_t>
13041 ,base_data_t{
13043 variable_data_t(ptr a)noexcept:_m(a){}
13044 variable_data_t(const variable_data_t&)noexcept=default;
13045 virtual ~variable_data_t()noexcept override final=default;
13046
13047 virtual void be_set(ptr a)noexcept override final{_m=a;}
13048 [[nodiscard]]virtual ptr get_value()noexcept override final{return _m;}
13049 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<variable_data_t>(_m);}
13050 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<variable_data_t>;}
13051 };
13052 private:
13053 mutable comn_ptr_t<base_data_t> _m;
13054 public:
13055 explicit value()noexcept:_m(get<variable_data_t>(null_ptr)){}
13056 constexpr explicit value(special_init_t)noexcept:_m(null_ptr){}
13057 explicit value(ptr a)noexcept:_m(get<constexpr_data_t>(a)){}
13058 explicit value(node_like* a)noexcept:value(ptr(a)){}
13059 value(base_data_t*a)noexcept:_m(a){}
13060
13061 value(const this_t&a)noexcept=default;
13062 value(this_t&&a)noexcept=default;
13063 ~value()noexcept=default;
13064
13065 this_t&operator=(ptr a){
13066 _m->be_set(a);
13067 return *this;
13068 }
13070 return operator=(as_ptr(a));
13071 }
13072
13073 [[nodiscard]]operator ptr(){
13074 return _m->get_value();
13075 }
13076 [[nodiscard]]operator const_ptr()const{
13077 return _m->get_value();
13078 }
13079 [[nodiscard]]ptr operator&(){
13080 return operator ptr();
13081 }
13082 [[nodiscard]]const_ptr operator&()const{
13083 return operator const_ptr();
13084 }
13085 [[nodiscard]]explicit operator bool()const{return bool(_m->get_value());}
13086
13087 void ref_to(this_t a)noexcept{
13088 _m.do_replace(a._m);
13089 }
13090 void un_ref()noexcept{
13091 _m=_m->copy();
13092 }
13093 void re_ref_to(this_t a)noexcept{
13094 _m=a._m;
13095 }
13097 a.ref_to(*this);
13098 return*this;
13099 }
13100
13101 template<typename T>
13102 [[nodiscard]]auto operator[](T&&index){
13103 return (*operator&())[forward<T>(index)];
13104 }
13105 template<typename...Args> requires(invoke<node_like>.able<Args...>)
13106 inline auto operator()(Args&&... rest)noexcept(invoke<node_like>.nothrow<Args...>){return(*operator&())(forward<Args>(rest)...);}
13107 [[nodiscard]]auto operator==(auto&&a)const noexcept{
13108 try{
13109 return const_ptr(*this) == const_ptr(as_value(a));
13110 }
13111 catch(...){
13112 return unknown;
13113 }
13114 }
13115 [[nodiscard]]auto operator!=(auto&&a)const{
13116 return !operator==(a);
13117 }
13118 [[nodiscard]]operator ptr::for_delete_t*(){
13119 return _m->get_value();
13120 }
13121 };
13122
13123 static value::base_data_t*the_get_null_ptr(const value::base_data_t*)noexcept{
13124 return&value::null_data;
13125 }
13126
13128
13129 INTER_NAMESPACE(base)
13130 template<>
13131 distinctive inline core::value const_default_value_of<core::value>{special_init};
13133
13134 INTER_NAMESPACE(core)
13135
13136 //file_end
13137
13138 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
13139
13140 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/node_like_using_value_func_defs.hpp"
13141 //defs.hpp
13142 //at namespace elc::defs::core
13143 /*
13144 未完成的elc解释器core文件
13145 由steve02081504与Alex0125设计、编写
13146 转载时请在不对此文件做任何修改的同时注明出处
13147 项目地址:https://github.com/steve02081504/ELC
13148 */
13149 push_and_disable_msvc_warning(26440);//nothrow警告diss
13150 [[nodiscard]]inline value node_like::be_eval(){
13151 return value(this);
13152 }
13153 [[nodiscard]]inline value node_like::be_call(ptr){
13154 return value(this);
13155 }
13157
13158 [[nodiscard]]inline value node_like::operator[](const value index){
13159 return arec(index);
13160 }
13161
13162 //file_end
13163
13164 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
13165
13166 //file_end
13167
13168 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13169 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/_body.hpp"
13170 //_body.hpp
13171 //at namespace elc::defs::base
13172 /*
13173 未完成的elc解释器base文件
13174 由steve02081504与Alex0125设计、编写
13175 转载时请在不对此文件做任何修改的同时注明出处
13176 项目地址:https://github.com/steve02081504/ELC
13177 */
13178 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/base_runtime_exception.hpp"
13179 //base_runtime_exception.hpp
13180 //at namespace elc::defs::base
13181 /*
13182 未完成的elc解释器base文件
13183 由steve02081504与Alex0125设计、编写
13184 转载时请在不对此文件做任何修改的同时注明出处
13185 项目地址:https://github.com/steve02081504/ELC
13186 */
13187 struct base_runtime_exception:runtime_exception{
13188 using runtime_exception::runtime_exception;
13189 };
13190
13191 //file_end
13192
13193 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/_body.hpp"
13194 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/core_runtime_internal_helper.hpp"
13195 //_body.hpp
13196 //at namespace elc::defs::base
13197 /*
13198 未完成的elc解释器base文件
13199 由steve02081504与Alex0125设计、编写
13200 转载时请在不对此文件做任何修改的同时注明出处
13201 项目地址:https://github.com/steve02081504/ELC
13202 */
13203 namespace core_runtime_internal_helper_n{
13205 using base_runtime_exception::base_runtime_exception;
13206 constexpr base_t()noexcept:
13207 base_runtime_exception(locale::str::exception::core_runtime_internal_helper_leak){}
13208 };
13209 //
13212 };
13214 }
13215 //#include ".hpp"
13216
13217 //file_end
13218
13219 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/_body.hpp"
13220
13221 //file_end
13222
13223 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13224 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13225 //_body.hpp
13226 //at namespace elc::defs::base
13227 /*
13228 未完成的elc解释器base文件
13229 由steve02081504与Alex0125设计、编写
13230 转载时请在不对此文件做任何修改的同时注明出处
13231 项目地址:https://github.com/steve02081504/ELC
13232 */
13233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/base_constexpr.hpp"
13234 //base_constexpr.hpp
13235 //at namespace elc::defs::core
13236 /*
13237 未完成的elc解释器base文件
13238 由steve02081504与Alex0125设计、编写
13239 转载时请在不对此文件做任何修改的同时注明出处
13240 项目地址:https://github.com/steve02081504/ELC
13241 */
13242 struct base_constexpr_t:node_like,instance_struct<base_constexpr_t>{
13243 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<base_constexpr_t>;}
13244 protected:
13245 [[nodiscard]]virtual constexpr size_t equal_level()const noexcept override{return magic_number::god;}
13246 [[nodiscard]]virtual constexpr size_t eq_level()const noexcept override{return magic_number::god;}
13247 public:
13248 base_constexpr_t()noexcept:node_like(never_ref_num_zero){}
13249 constexpr virtual ~base_constexpr_t()noexcept override=default;
13250
13251 [[nodiscard]]virtual value arec(const value)noexcept override{return value(this);}
13252
13253 virtual void clear()noexcept override final{nothing}
13254
13255 virtual void be_replace_as(ptr)noexcept override{nothing}
13256 };
13257
13258 //file_end
13259
13260 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13261 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/void.hpp"
13262 //void.hpp
13263 //at namespace elc::defs::core
13264 /*
13265 未完成的elc解释器base文件
13266 由steve02081504与Alex0125设计、编写
13267 转载时请在不对此文件做任何修改的同时注明出处
13268 项目地址:https://github.com/steve02081504/ELC
13269 */
13270 /*
13271 使用elc::the_void来访问此值
13272 或者通过包含<elc/void_name>来使用elc::void访问此值,并使用::void来访问c艹的原生void
13273 */
13275 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<void_t>;}
13276 protected:
13277 [[nodiscard]]virtual constexpr size_t equal_level()const noexcept override{return max(type_info<size_t>);}
13278 [[nodiscard]]virtual constexpr size_t eq_level()const noexcept override{return max(type_info<size_t>);}
13279 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13280 if(this==a)
13281 return either;//当void是void时,void不是void
13282 else
13283 return neither;//当a不是void时,void是a
13284 }
13285 //我不知道为什么这么写,反正很有趣
13286 public:
13287 [[nodiscard]]virtual constexpr explicit operator hash_t()const noexcept override{return hash(nothing);}
13288 [[nodiscard]]virtual constexpr explicit operator logical_bool()const noexcept override{return neither;}//void 应当不真不假
13290
13291 [[nodiscard]]constexpr node_like*the_get_null_ptr(const node_like*)noexcept{return addressof((node_like&)the_void);}
13292
13293 //file_end
13294
13295 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13296 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/nil.hpp"
13297 //nil.hpp
13298 //at namespace elc::defs::core
13299 /*
13300 未完成的elc解释器base文件
13301 由steve02081504与Alex0125设计、编写
13302 转载时请在不对此文件做任何修改的同时注明出处
13303 项目地址:https://github.com/steve02081504/ELC
13304 */
13306 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<nil_t>;}
13307 protected:
13308 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{return !logical_bool(a);}
13309 public:
13310 [[nodiscard]]virtual constexpr explicit operator hash_t()const noexcept override{return hash(false);}
13311 [[nodiscard]]virtual constexpr explicit operator logical_bool()const noexcept override{return false;}
13312 }nil{};
13313
13314 //file_end
13315
13316 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13317 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/t.hpp"
13318 //t.hpp
13319 //at namespace elc::defs::core
13320 /*
13321 未完成的elc解释器base文件
13322 由steve02081504与Alex0125设计、编写
13323 转载时请在不对此文件做任何修改的同时注明出处
13324 项目地址:https://github.com/steve02081504/ELC
13325 */
13326 distinctive inline struct t_t final:base_constexpr_t{
13327 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<t_t>;}
13328 protected:
13329 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{return logical_bool(a);}
13330 public:
13331 [[nodiscard]]virtual constexpr explicit operator hash_t()const noexcept override{return hash(true);}
13332 [[nodiscard]]virtual constexpr explicit operator logical_bool()const noexcept override{return true;}
13333
13334 //nothing is true,everything is permitted.
13335 [[noreturn]]virtual void be_replace_as(ptr)noexcept override{::std::exit(0);}
13336 }t{};
13337
13338 //file_end
13339
13340 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13341
13342 //file_end
13343
13344 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13345 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13346 //_body.hpp
13347 //at namespace elc::defs::core
13348 /*
13349 未完成的elc解释器core文件
13350 由steve02081504与Alex0125设计、编写
13351 转载时请在不对此文件做任何修改的同时注明出处
13352 项目地址:https://github.com/steve02081504/ELC
13353 */
13354 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/common_node.hpp"
13355 //common_node.hpp
13356 //at namespace elc::defs::core
13357 /*
13358 未完成的elc解释器core文件
13359 由steve02081504与Alex0125设计、编写
13360 转载时请在不对此文件做任何修改的同时注明出处
13361 项目地址:https://github.com/steve02081504/ELC
13362 */
13363 struct common_node:node_like,instance_struct<common_node>{
13365
13366 map_t<value,const_weak_ptr> _m;
13367
13368 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<this_t>;}
13369 protected:
13370 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13371 if(a->get_type_info() != this->get_type_info())
13372 return false;
13373 const this_t*p=down_cast<const this_t*>(a.get());
13374 return _m==p->_m;
13375 }
13376 public:
13377 [[nodiscard]]virtual value arec(const value index)override{return _m[&index];}
13378
13379 virtual void clear()noexcept override{_m.clear();}
13380 };
13381
13382 //file_end
13383
13384 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13385 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/cons.hpp"
13386 //common_node.hpp
13387 //at namespace elc::defs::core
13388 /*
13389 未完成的elc解释器core文件
13390 由steve02081504与Alex0125设计、编写
13391 转载时请在不对此文件做任何修改的同时注明出处
13392 项目地址:https://github.com/steve02081504/ELC
13393 */
13394 inline value car_of(ptr p){
13395 return (*p)[t];
13396 }
13397 inline value cdr_of(ptr p){
13398 return (*p)[nil];
13399 }
13400 inline value car_of(auto&&node){
13401 return car_of(as_ptr(node));
13402 }
13403 inline value cdr_of(auto&&node){
13404 return cdr_of(as_ptr(node));
13405 }
13406
13407 struct cons:node_like,instance_struct<cons>{
13408 typedef cons this_t;
13409
13412
13413 cons(ptr car,ptr cdr){
13414 _car = car;
13415 _cdr = cdr;
13416 }
13417
13418 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<cons>;}
13419 protected:
13420 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13421 if(a->get_type_info() != this->get_type_info())
13422 return false;
13423 const this_t*p=down_cast<const this_t*>(a.get());
13424 return _car==p->_car&&_cdr==p->_cdr;
13425 }
13426 public:
13427 [[nodiscard]]virtual value arec(const value index)override{
13428 const_ptr v=index;
13429 if(v==&nil)
13430 return _cdr;
13431 elseif(v==&t)
13432 return _car;
13433 else{
13434 ptr to=get<common_node>();
13435 _car >> car_of(to);
13436 _cdr >> cdr_of(to);
13437 be_replace_as(to);
13438 return (*to)[v];
13439 }
13440 }
13441
13442 virtual void clear()noexcept override{as_value(&the_void)>>_car>>_cdr;}
13443 };
13444
13445 [[nodiscard]]inline ptr make_list()noexcept{return &nil;}
13446 template<typename T,typename...Args>
13447 [[nodiscard]]inline ptr make_list(T&&first,Args&&...rest){
13448 ELC_TEST_EVENTNAME("make_list调用");
13449 return get<cons>(as_ptr(first),make_list(forward<Args>(rest)...));
13450 }
13451
13452 //file_end
13453
13454 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13455 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/expr.hpp"
13456 //expr.hpp
13457 //at namespace elc::defs::core
13458 /*
13459 未完成的elc解释器core文件
13460 由steve02081504与Alex0125设计、编写
13461 转载时请在不对此文件做任何修改的同时注明出处
13462 项目地址:https://github.com/steve02081504/ELC
13463 */
13464 struct expr:cons,instance_struct<expr>{
13465 typedef expr this_t;
13467 public:
13468 using cons::_car;
13469 using cons::_cdr;
13470 using cons::cons;
13471
13472 [[nodiscard]]virtual value be_eval()override{
13473 return as_ptr(_car)->be_call(_cdr);
13474 }
13475 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<expr>;}
13476 };
13477
13478 //file_end
13479
13480 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13481 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/base_binary_function_node.hpp"
13482 //base_binary_function_node.hpp
13483 //at namespace elc::defs::core
13484 /*
13485 未完成的elc解释器core文件
13486 由steve02081504与Alex0125设计、编写
13487 转载时请在不对此文件做任何修改的同时注明出处
13488 项目地址:https://github.com/steve02081504/ELC
13489 */
13490 struct base_binary_function_node:node_like,instance_struct<base_binary_function_node>{
13492
13493 function_t<value(ptr)> _func;
13494
13495 base_binary_function_node(function_t<value(ptr)> func)noexcept:_func(func){}
13496 base_binary_function_node(function_t<void(ptr)> func)noexcept{
13497 _func = lambda_with_catch(func)(ptr p)mutable{
13498 func(p);
13499 return as_value(the_void);
13500 };
13501 }
13502 base_binary_function_node(function_t<void()> func)noexcept{
13503 _func = lambda_with_catch(func)(ptr)mutable{
13504 func();
13505 return as_value(the_void);
13506 };
13507 }
13508
13509 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<this_t>;}
13510 [[nodiscard]]virtual value be_call(ptr arg_list)override{return _func(arg_list);}
13511 protected:
13512 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13513 if(a->get_type_info() != this->get_type_info())
13514 return false;
13515 const this_t*p=down_cast<const this_t*>(a.get());
13516 try{
13517 return _func==p->_func;
13518 }
13519 catch(...){
13520 return unknown;
13521 }
13522 }
13523 public:
13524 [[nodiscard]]virtual value arec(const value index)override{return the_void[index];}
13525
13526 virtual void clear()noexcept override{_func=nullptr;}
13527 };
13528
13529 //file_end
13530
13531 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13532 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/binary_node_t.hpp"
13533 //binary_node_t.hpp
13534 //at namespace elc::defs::core
13535 /*
13536 未完成的elc解释器core文件
13537 由steve02081504与Alex0125设计、编写
13538 转载时请在不对此文件做任何修改的同时注明出处
13539 项目地址:https://github.com/steve02081504/ELC
13540 */
13543
13544 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<this_t>;}
13545 [[nodiscard]]virtual base_type_info_t get_additional_type_info()const noexcept=0;
13546 protected:
13547 [[noreturn]] virtual void throw_self_ptr()const=0;
13548 [[noreturn]] virtual void throw_self_ptr()=0;
13549 template<typename T>
13550 friend[[nodiscard]]inline maybe_fail_reference<T> maybe_fail_use_by_ref_as(ptr p)noexcept;
13551 template<typename T>
13552 friend[[nodiscard]]inline maybe_fail_reference<T> maybe_fail_use_by_ref_as(ptr p)noexcept;
13553 template<typename T>
13554 friend[[nodiscard]]inline const T& const_use_by_ref_as(const_ptr p)noexcept;
13555 };
13556 template<typename T>
13560
13562
13563 binary_node_t(const T&a)noexcept:_m(a){}
13564 binary_node_t(T&&a)noexcept:_m(a){}
13565
13566 [[nodiscard]]virtual base_type_info_t get_additional_type_info()const noexcept override{return type_info<this_t>;}
13567 private:
13568 static constexpr bool hash_nothrow_helper=hash.able<T>?
13569 hash.nothrow<T>:1;
13570 public:
13571 [[nodiscard]]virtual explicit operator hash_t()const noexcept(hash_nothrow_helper)override{
13572 if constexpr(hash.able<T>)
13573 return hash(_m);
13574 else
13575 #if defined(_MSC_VER)
13576 [[gsl::suppress(f.6)]]
13577 #endif
13578 return node_like::operator hash_t();
13579 }
13580 protected:
13581 [[noreturn]] virtual void throw_self_ptr()const override{throw&_m;}
13582 [[noreturn]] virtual void throw_self_ptr()override{throw&_m;}
13583 [[nodiscard]]virtual logical_bool eq_with(const_ptr a)const noexcept override{
13584 using defs::equal;//貌似msvc在这里有bug
13585 if constexpr(equal.able<T>){
13586 if(a->get_type_info() != this->get_type_info())
13587 return false;
13588 const base_t*base_p=down_cast<const base_t*>(a.get());
13589 if(base_p->get_type_info() != this->get_type_info())
13590 return false;
13591 const this_t*p=down_cast<const this_t*>(base_p);
13592 return _m==p->_m;
13593 }
13594 else
13595 return node_like::eq_with(a);
13596 }
13597 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13598 return eq_with(a);
13599 }
13600 private:
13601 static constexpr bool arec_nothrow_helper=was_not_an_ill_form(arec_as_value(_m,declvalue(const value&)))?
13602 was_not_an_ill_form_and_noexcept(arec_as_value(_m,declvalue(const value&))):1;
13603 public:
13604 [[nodiscard]]virtual value arec(const value index)noexcept(arec_nothrow_helper)override{
13605 if constexpr(was_not_an_ill_form(arec_as_value(_m,index)))
13606 return arec_as_value(_m,index);
13607 else
13608 return as_value(this);
13609 }
13610 private:
13611 static constexpr bool clear_nothrow_helper= was_not_an_ill_form(declvalue(T).clear())?
13613 re_construct.nothrow<T>;
13614 public:
13615 virtual void clear()noexcept(clear_nothrow_helper)override{
13616 if constexpr(was_not_an_ill_form(declvalue(T).clear()))
13617 _m.clear();
13618 else
13619 re_construct(&_m);
13620 }
13621 };
13622
13623 template<typename T>
13624 [[nodiscard]]inline bool was_an(const_ptr p)noexcept{
13625 typedef binary_node_t<T> target_node_t;
13626 if(p->get_type_info() == type_info<binary_node_base_t>){
13627 auto base_p = down_cast<const binary_node_base_t*>(p.get());
13628 if(base_p->get_additional_type_info() == type_info<target_node_t>)
13629 return true;
13630 elseif constexpr(::std::is_class_v<T> && !::std::is_final_v<T>){
13631 try{
13632 base_p->throw_self_ptr();
13633 }
13634 catch(const T*){
13635 return true;
13636 }
13637 catch(const void*){}
13638 }
13639 }
13640 return false;
13641 }
13642 template<typename T>
13644 typedef binary_node_t<T> target_node_t;
13645 if(p->get_type_info() == type_info<binary_node_base_t>){
13646 auto base_p = down_cast<binary_node_base_t*>(p.get());
13647 if(base_p->get_additional_type_info() == type_info<target_node_t>)
13648 return down_cast<target_node_t*>(base_p)->_m;
13649 elseif constexpr(::std::is_class_v<T> && !::std::is_final_v<T>){
13650 try{
13651 base_p->throw_self_ptr();
13652 }
13653 catch(T*aret){
13654 return*aret;
13655 }
13656 catch(void*){}
13657 }
13658 }
13659 return note::fail;
13660 }
13661 template<typename T>
13662 [[nodiscard]]inline T& use_by_ref_as(ptr p)noexcept{
13663 return maybe_fail_use_by_ref_as<T>(p).get_ref();
13664 }
13665 template<typename T>
13666 [[nodiscard]]inline const T& const_use_by_ref_as(const_ptr p)noexcept{
13667 typedef binary_node_t<T> target_node_t;
13668 if(p->get_type_info() == type_info<binary_node_base_t>){
13669 auto base_p = down_cast<const binary_node_base_t*>(p.get());
13670 if(base_p->get_additional_type_info() == type_info<target_node_t>)
13671 return down_cast<const target_node_t*>(base_p)->_m;
13672 elseif constexpr(::std::is_class_v<T> && !::std::is_final_v<T>){
13673 try{
13674 base_p->throw_self_ptr();
13675 }
13676 catch(const T*aret){
13677 return*aret;
13678 }
13679 catch(const void*){}
13680 }
13681 }
13682 return const_default_value_of<T>;
13683 }
13684 template<typename T>
13685 [[nodiscard]]inline T use_as(const_ptr p)noexcept{
13686 return const_use_by_ref_as<T>(p);
13687 }
13688 template<typename T>
13689 [[nodiscard]]inline const T& use_by_ref_as(const_ptr p)noexcept{
13690 return const_use_by_ref_as<T>(p);
13691 }
13692 template<typename T>
13693 [[nodiscard]]inline const T& use_by_ref_as(auto&&a)noexcept{
13694 return use_by_ref_as<T>(as_ptr(a));
13695 }
13696 template<typename T>
13697 [[nodiscard]]inline ptr make_binary_node_from(T a)noexcept{
13698 return get<binary_node_t<T>>(move(a));
13699 }
13700 template<typename T>
13702 template<typename T>
13703 [[nodiscard]]inline ptr make_long_term_binary_node_from(T a)noexcept{
13704 ptr& to = long_term_binary_node_storager<T>[a];
13705 if(!bool(to) || const_use_by_ref_as<T>(to)!=a)
13706 to = make_binary_node_from<T>(move(a));
13707 return to;
13708 }
13709
13710 //file_end
13711
13712 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13713 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/code_list.hpp"
13714 //code_list.hpp
13715 //at namespace elc::defs::core
13716 /*
13717 未完成的elc解释器core文件
13718 由steve02081504与Alex0125设计、编写
13719 转载时请在不对此文件做任何修改的同时注明出处
13720 项目地址:https://github.com/steve02081504/ELC
13721 */
13722 inline value eval(ptr p){
13723 return p->be_eval();
13724 }
13725 inline value eval(auto&&node){
13726 return eval(as_ptr(node));
13727 }
13728 struct code_list:cons,instance_struct<code_list>{
13731 public:
13732 using cons::cons;
13733
13734 [[nodiscard]]virtual value be_eval()override{
13735 ptr self = this;
13736 value aret{special_init};
13737 from_goto:
13738 try{
13739 do{
13740 eval(car_of(self)) >> aret;
13741 self=cdr_of(self);
13742 }while(self);
13743 }
13745 self=info.to;
13746 goto from_goto;
13747 }
13749 }
13750 return aret;
13751 }
13752 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<code_list>;}
13753 };
13754
13755 //file_end
13756
13757 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13758
13759 //file_end
13760
13761 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13762 }
13763
13764 #if defined(ELC_TEST_ON)
13765 namespace core_part_test{
13766 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_test.hpp"
13767 //_test.hpp
13768 /*
13769 未完成的elc解释器core文件
13770 由steve02081504与Alex0125设计、编写
13771 转载时请在不对此文件做任何修改的同时注明出处
13772 项目地址:https://github.com/steve02081504/ELC
13773 */
13774 inline void test(){
13775 ELC_TEST_EVENTNAME("core部分测试");
13776 }
13777 inline void test_log_out(){
13778 }
13779 inline void test_end(){
13780 }
13781
13782 //file_end
13783
13784 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13785 }
13786 #endif
13787
13788 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
13789 //_undefs.hpp
13790 /*
13791 未完成的elc解释器basic文件
13792 由steve02081504与Alex0125设计、编写
13793 转载时请在不对此文件做任何修改的同时注明出处
13794 项目地址:https://github.com/steve02081504/ELC
13795 */
13796 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
13797 //_undefs.hpp
13798 /*
13799 未完成的elc解释器_share文件
13800 由steve02081504与Alex0125设计、编写
13801 转载时请在不对此文件做任何修改的同时注明出处
13802 项目地址:https://github.com/steve02081504/ELC
13803 */
13804
13805 //defs at "_defs.hpp"
13806
13807 #if defined(_MSC_VER)
13808 #pragma warning(pop)
13809 #endif
13810 #undef suppress_msvc_warning
13811 #undef disable_msvc_warning
13812 #undef push_msvc_warning
13813 #undef pop_msvc_warning
13814 #undef push_and_disable_msvc_warning
13815
13816 //for basic_environment.hpp
13817 #undef BIT_POSSIBILITY
13818 //
13819 #if defined(ELC_VOID_NAME)
13820 #define void the_void
13821 #endif
13822
13823 // #undef often_noexcept
13824 #undef noexcept_as
13825 #undef noexcept_as_auto
13826 #undef constexpr_as
13827 #undef constexpr_as_auto
13828
13829 #undef using_method_from_base_t
13830 #undef using_method_from_value
13831
13832 #undef floop
13833 #undef enable_adl
13834
13835 #undef re_declvalue
13836 #undef re_decltype
13837
13838 #undef declvalue
13839
13840 #undef template_error
13841 #undef template_warning
13842
13843 #undef type_info_of
13844 #undef type_name_of
13845
13846 #undef is_common_attribute
13847 #undef is_special_attribute
13848
13849 #undef has_attribute
13850 #undef not_has_attribute
13851
13852 #undef float_size_of
13853 #undef bitnum_of
13854
13855 #undef def_common_attribute_with_nothing
13856 #undef def_special_attribute_with_nothing
13857
13858 #undef common_attribute_t
13859 #undef special_attribute_t
13860
13861 #undef enable_if
13862 #undef enabled_by_default
13863 #undef disabled_by_default
13864 #undef enable_if_not_ill_form
13865 #undef enable_flag
13866
13867 #undef was_an_ill_form
13868 #undef was_an_ill_form_with_parameter
13869 #undef was_not_an_ill_form
13870 #undef was_not_an_ill_form_and_noexcept
13871 #undef was_not_an_ill_form_with_parameter
13872
13873 #undef recursive_lambda
13874 #undef get_recursive_lambda_caller
13875 #undef lambda
13876 #undef lambda_with_catch
13877 #undef self_recursion
13878 #undef lambda_RLSRRS
13879
13880 #undef MAGIC
13881
13882 #undef nothing
13883
13884 #undef elseif
13885 #undef _big_than_
13886 #undef _small_than_
13887
13888 #if defined(_MSC_VER)
13889 #undef not
13890 #undef and
13891 #undef or
13892 #endif
13893
13894 #undef INTER_NAMESPACE
13895 #undef BREAK_NAMESPACE
13896
13897 #undef szie
13898 #undef form
13899
13900 #undef template_name
13901 #undef type_name
13902
13903 #undef not_in_debug
13904
13905 #undef es
13906 #undef ec
13907
13908 #undef ELC_TEST_EVENTNAME
13909
13910 #undef override_instance_struct
13911
13912 #undef distinctive
13913
13914 #undef force_inline
13915
13916 #undef with_no_vtable
13917
13918 #undef in_consteval
13919
13920 #undef no_vtable_struct
13921 #undef no_vtable_class
13922
13923 //file_end
13924
13925 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
13926
13927 //file_end
13928
13929 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13930 }
13931 namespace elc{
13932 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_export.hpp"
13933 //_export.hpp
13934 //at namespace elc
13935 /*
13936 未完成的elc解释器core文件
13937 由steve02081504与Alex0125设计、编写
13938 转载时请在不对此文件做任何修改的同时注明出处
13939 项目地址:https://github.com/steve02081504/ELC
13940 */
13941 #define export using defs::core::
13942 export node_like;
13943 export ptr;
13947 export value;
13948
13949 export nil;
13950 export t;
13952
13954 export as_ptr;
13955 export common_node;
13956 #undef export
13957
13958 //file_end
13959
13960 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13961 }
13962 #if defined(ELC_STRING)
13963 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
13964 //string_arec_as_value.hpp
13965 //at namespace ::
13966 //multi when ELC_STRING & ELC_CORE
13967 /*
13968 未完成的elc解释器string文件
13969 由steve02081504与Alex0125设计、编写
13970 转载时请在不对此文件做任何修改的同时注明出处
13971 项目地址:https://github.com/steve02081504/ELC
13972 */
13973 namespace elc::defs{
13974 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
13975 //_defs.hpp
13976 /*
13977 未完成的elc解释器basic文件
13978 由steve02081504与Alex0125设计、编写
13979 转载时请在不对此文件做任何修改的同时注明出处
13980 项目地址:https://github.com/steve02081504/ELC
13981 */
13982 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
13983 //_defs.hpp
13984 /*
13985 未完成的elc解释器_share文件
13986 由steve02081504与Alex0125设计、编写
13987 转载时请在不对此文件做任何修改的同时注明出处
13988 项目地址:https://github.com/steve02081504/ELC
13989 */
13990
13991 //undefs at "_undefs.hpp"
13992
13993 //set ELC_WARNING_LEVEL default to 4(max)
13994 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
13995
13996 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
13997 //basic_environment.hpp
13998 /*
13999 未完成的elc解释器_share文件
14000 由steve02081504与Alex0125设计、编写
14001 转载时请在不对此文件做任何修改的同时注明出处
14002 项目地址:https://github.com/steve02081504/ELC
14003 */
14004
14005 //每个bit(不是字节)的可能性
14006 //为什么c艹委员会不定义这个?
14007 #define BIT_POSSIBILITY 2
14008
14009 //file_end
14010
14011 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14012
14013 #if defined(_MSC_VER)
14014 #pragma warning(push,ELC_WARNING_LEVEL)
14015 #pragma warning(disable:4099)//class与struct混用警告diss
14016 #pragma warning(disable:26812)//enum class安利diss.
14017 #pragma warning(disable:4584)//重复子类警告diss
14018 #pragma warning(disable:4250)//域控制继承警告diss
14019 #pragma warning(disable:26432)//不完全默认方法警告diss
14020 #pragma warning(disable:26435)//virtual override方法警告diss
14021 #pragma warning(disable:26481)//容器安利diss
14022 #pragma warning(disable:26446)//gsl::at安利diss
14023 #pragma warning(disable:26434)//方法覆盖警告diss
14024 #pragma warning(disable:26429)//gsl::not_null安利diss
14025 #pragma warning(disable:26471)//对void*进行static_cast安利diss
14026 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
14027 #pragma warning(disable:26473)//相同指针显式cast警告diss
14028 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
14029 #pragma warning(disable:26485)//数组作指针警告diss
14030 #pragma warning(disable:26490)//reinterpret_cast警告diss
14031 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
14032 #pragma warning(disable:26482)//非常数数组索引警告diss
14033 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
14034 #endif
14035 #if defined(_MSC_VER)
14036 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
14037 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
14038 #define push_msvc_warning() __pragma(warning(push))
14039 #define pop_msvc_warning() __pragma(warning(pop))
14040 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
14041 #else
14042 #define suppress_msvc_warning(...)
14043 #define disable_msvc_warning(...)
14044 #define push_msvc_warning()
14045 #define pop_msvc_warning()
14046 #define push_and_disable_msvc_warning(...)
14047 #endif
14048 //
14049 #if defined(ELC_VOID_NAME)
14050 #undef void
14051 #endif
14052
14053 // #define often_noexcept
14054 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
14055 #define noexcept_as_auto MAGIC//哦现在有了
14056 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
14057 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
14058
14059 #define using_method_from_base_t(name,...) \
14060 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
14061 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
14062 {\
14063 return base_t::name(forward<Args>(rest)...);\
14064 }\
14065
14066 #define using_method_from_value(name,value_name,...) \
14067 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
14068 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
14069 {\
14070 return value_name.name(forward<Args>(rest)...);\
14071 }\
14072
14073 #define floop while(__builtin_is_my_dick_still_there())
14074 #define enable_adl(name) void name()noexcept=delete
14075
14076 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
14077 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
14078
14079 #define declvalue(...) (::std::declval<__VA_ARGS__>())
14080
14081 /*实例化到此将引发错误*/
14082 #define template_error(reason) static_assert(template_error_helper<T>,reason)
14083 /*实例化到此将引发警告*/
14084 #define template_warning(reason) template_warning_helper<T>(reason)
14085
14086 //for type_info
14087 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
14088 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
14089
14090 #define is_common_attribute(name) public attribute<T,name<T>>
14091 #define is_special_attribute(name) public attribute<T,name>
14092
14093 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
14094 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
14095
14096 //for float_size_t
14097 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
14098 //bitnum_of
14099 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
14100
14101 //for attribute
14102 #define def_common_attribute_with_nothing(name) \
14103 template<typename T>\
14104 class name{}\
14105
14106 #define def_special_attribute_with_nothing(name) \
14107 class name{}\
14108
14109 #define common_attribute_t template<class>class
14110 #define special_attribute_t class
14111
14112 /*
14113 若参数的布尔值为零,那么此模板不会实例化
14114
14115 为什么不用cpp20的constraints?
14116 1.不能类内定义
14117 2.不能作为模板参数
14118 一句话总结:c艹标准会sb
14119 */
14120 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
14121 /*默认参与模板候选*/
14122 #define enabled_by_default class enable_state=void
14123 /*默认不参与模板候选*/
14124 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
14125 /*若参数为病式,那么此模板不会实例化*/
14126 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
14127 /*用于模板声明*/
14128 #define enable_flag class enable_state
14129
14130 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
14131 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
14132 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
14133 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
14134 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
14135
14136 /*让lambda递归更加美观*/
14137 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
14138 /*让lambda递归更加美观*/
14139 #define get_recursive_lambda_caller(name) \
14140 lambda_with_catch(&)(auto&&...Args){\
14141 return name(name,Args...);\
14142 }
14143 /*让lambda定义更加美观*/
14144 #define lambda []
14145 /*让lambda定义更加美观*/
14146 #define lambda_with_catch(...) [__VA_ARGS__]
14147 /*让lambda递归更加美观*/
14148 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
14149 //recursive_lambda_self_referential_reserved_symbolname
14150 #define lambda_RLSRRS _my_jb_super_sb_name_
14151
14152 #define MAGIC//ahh,ko no tenno da!
14153
14154 /*装饰性语法糖*/
14155 #define nothing
14156
14157 /*aya风格语法糖*/
14158 #define elseif else if
14159 /*aya风格语法糖*/
14160 #define _big_than_ >
14161 /*aya风格语法糖*/
14162 #define _small_than_ <
14163
14164 #if defined(_MSC_VER)
14165 #define not !
14166 #define and &&
14167 #define or ||
14168 #endif
14169
14170 /*进入名称空间,并不是很美观*/
14171 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
14172 /*退出名称空间,并不是很美观*/
14173 #define BREAK_NAMESPACE }
14174
14175 /*template说明符*/
14176 #define template_name template
14177 /*template说明符*/
14178 #define type_name class
14179
14180 #if defined(DEBUG) || defined(_DEBUG)
14181 #define not_in_debug 0
14182 #else
14183 #define not_in_debug 1
14184 #endif
14185
14186 #define es U""
14187 #define ec(ch) U ## ch
14188
14189 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
14190 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
14191 #else
14192 #define ELC_TEST_EVENTNAME(name)
14193 #endif
14194
14195 #define override_instance_struct \
14196 protected:\
14197 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
14198 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
14199 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
14200 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
14201 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
14202
14203 #if defined(_WIN32)
14204 #define distinctive __declspec(dllexport)
14205 #else
14206 #define distinctive
14207 #endif
14208
14209 #if defined(_WIN32)
14210 #define force_inline __forceinline
14211 #elif defined(__GNUC__)
14212 #define force_inline __attribute__((always_inline)) inline
14213 #else
14214 #define force_inline inline
14215 #endif
14216
14217 #if defined(_WIN32)
14218 #define with_no_vtable __declspec(novtable)
14219 #else
14220 #define with_no_vtable
14221 #endif
14222
14223 #define in_consteval (::std::is_constant_evaluated())
14224
14225 #define no_vtable_struct struct with_no_vtable
14226 #define no_vtable_class class with_no_vtable
14227
14228 //file_end
14229
14230 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
14231
14232 //file_end
14233
14234 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
14235
14236 namespace string_n{
14237 template<class char_T>
14238 value arec_as_value(string_t<char_T>&str,const value index){
14239 size_t i=size_t(use_as<int_t>(index));
14240 if(!i)
14241 i=size_t(use_as<uint_t>(index));
14242 struct arec_data_t final:instance_struct<arec_data_t>
14243 ,value::base_data_t{
14244 typename string_t<char_T>::arec_t _m;
14245 arec_data_t(string_t<char_T>&str,size_t index)noexcept:_m(&str,index){};
14246 arec_data_t(const arec_data_t&ref)noexcept:_m(special_init,ref._m){}
14247 virtual ~arec_data_t()noexcept override final=default;
14248
14249 virtual void be_set(ptr a)noexcept override final{move(_m)=use_as<char_T>(a);}
14250 [[nodiscard]]virtual ptr get_value()noexcept override final{return core::make_binary_node_from<char_T>(move(_m));}
14251 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<arec_data_t>(*this);}
14252 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<arec_data_t>;}
14253 };
14254 return get<arec_data_t>(str,i);
14255 }
14256 }
14257
14258 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
14259 //_undefs.hpp
14260 /*
14261 未完成的elc解释器basic文件
14262 由steve02081504与Alex0125设计、编写
14263 转载时请在不对此文件做任何修改的同时注明出处
14264 项目地址:https://github.com/steve02081504/ELC
14265 */
14266 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
14267 //_undefs.hpp
14268 /*
14269 未完成的elc解释器_share文件
14270 由steve02081504与Alex0125设计、编写
14271 转载时请在不对此文件做任何修改的同时注明出处
14272 项目地址:https://github.com/steve02081504/ELC
14273 */
14274
14275 //defs at "_defs.hpp"
14276
14277 #if defined(_MSC_VER)
14278 #pragma warning(pop)
14279 #endif
14280 #undef suppress_msvc_warning
14281 #undef disable_msvc_warning
14282 #undef push_msvc_warning
14283 #undef pop_msvc_warning
14284 #undef push_and_disable_msvc_warning
14285
14286 //for basic_environment.hpp
14287 #undef BIT_POSSIBILITY
14288 //
14289 #if defined(ELC_VOID_NAME)
14290 #define void the_void
14291 #endif
14292
14293 // #undef often_noexcept
14294 #undef noexcept_as
14295 #undef noexcept_as_auto
14296 #undef constexpr_as
14297 #undef constexpr_as_auto
14298
14299 #undef using_method_from_base_t
14300 #undef using_method_from_value
14301
14302 #undef floop
14303 #undef enable_adl
14304
14305 #undef re_declvalue
14306 #undef re_decltype
14307
14308 #undef declvalue
14309
14310 #undef template_error
14311 #undef template_warning
14312
14313 #undef type_info_of
14314 #undef type_name_of
14315
14316 #undef is_common_attribute
14317 #undef is_special_attribute
14318
14319 #undef has_attribute
14320 #undef not_has_attribute
14321
14322 #undef float_size_of
14323 #undef bitnum_of
14324
14325 #undef def_common_attribute_with_nothing
14326 #undef def_special_attribute_with_nothing
14327
14328 #undef common_attribute_t
14329 #undef special_attribute_t
14330
14331 #undef enable_if
14332 #undef enabled_by_default
14333 #undef disabled_by_default
14334 #undef enable_if_not_ill_form
14335 #undef enable_flag
14336
14337 #undef was_an_ill_form
14338 #undef was_an_ill_form_with_parameter
14339 #undef was_not_an_ill_form
14340 #undef was_not_an_ill_form_and_noexcept
14341 #undef was_not_an_ill_form_with_parameter
14342
14343 #undef recursive_lambda
14344 #undef get_recursive_lambda_caller
14345 #undef lambda
14346 #undef lambda_with_catch
14347 #undef self_recursion
14348 #undef lambda_RLSRRS
14349
14350 #undef MAGIC
14351
14352 #undef nothing
14353
14354 #undef elseif
14355 #undef _big_than_
14356 #undef _small_than_
14357
14358 #if defined(_MSC_VER)
14359 #undef not
14360 #undef and
14361 #undef or
14362 #endif
14363
14364 #undef INTER_NAMESPACE
14365 #undef BREAK_NAMESPACE
14366
14367 #undef szie
14368 #undef form
14369
14370 #undef template_name
14371 #undef type_name
14372
14373 #undef not_in_debug
14374
14375 #undef es
14376 #undef ec
14377
14378 #undef ELC_TEST_EVENTNAME
14379
14380 #undef override_instance_struct
14381
14382 #undef distinctive
14383
14384 #undef force_inline
14385
14386 #undef with_no_vtable
14387
14388 #undef in_consteval
14389
14390 #undef no_vtable_struct
14391 #undef no_vtable_class
14392
14393 //file_end
14394
14395 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
14396
14397 //file_end
14398
14399 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
14400 }
14401
14402 //file_end
14403
14404 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
14405 #endif
14406
14407 //file_end
14408
14409 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
14410 #endif
14411
14412 //file_end
14413
14414 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
14415 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
14416 //lib_loader
14417 //at namespace ::
14418 /*
14419 未完成的elc解释器include文件
14420 由steve02081504与Alex0125设计、编写
14421 转载时请在不对此文件做任何修改的同时注明出处
14422 项目地址:https://github.com/steve02081504/ELC
14423 */
14424 #if !defined(ELC_LIB_LOADER)
14425 #define ELC_LIB_LOADER
14426 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
14427 //string
14428 //at namespace ::
14429 /*
14430 未完成的elc解释器include文件
14431 由steve02081504与Alex0125设计、编写
14432 转载时请在不对此文件做任何修改的同时注明出处
14433 项目地址:https://github.com/steve02081504/ELC
14434 */
14435 #if !defined(ELC_STRING)
14436 #define ELC_STRING
14437 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
14438 //base
14439 //at namespace ::
14440 /*
14441 未完成的elc解释器include文件
14442 由steve02081504与Alex0125设计、编写
14443 转载时请在不对此文件做任何修改的同时注明出处
14444 项目地址:https://github.com/steve02081504/ELC
14445 */
14446 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
14447
14448 //file_end
14449
14450 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
14451 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
14452 //_body.hpp
14453 //at namespace ::
14454 /*
14455 未完成的elc解释器string文件
14456 由steve02081504与Alex0125设计、编写
14457 转载时请在不对此文件做任何修改的同时注明出处
14458 项目地址:https://github.com/steve02081504/ELC
14459 */
14460 #if defined(ELC_TEST)
14461 #error "this part cannot be tested."
14462 #endif
14463 namespace elc::defs{
14464 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
14465 //_defs.hpp
14466 /*
14467 未完成的elc解释器basic文件
14468 由steve02081504与Alex0125设计、编写
14469 转载时请在不对此文件做任何修改的同时注明出处
14470 项目地址:https://github.com/steve02081504/ELC
14471 */
14472 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14473 //_defs.hpp
14474 /*
14475 未完成的elc解释器_share文件
14476 由steve02081504与Alex0125设计、编写
14477 转载时请在不对此文件做任何修改的同时注明出处
14478 项目地址:https://github.com/steve02081504/ELC
14479 */
14480
14481 //undefs at "_undefs.hpp"
14482
14483 //set ELC_WARNING_LEVEL default to 4(max)
14484 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14485
14486 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
14487 //basic_environment.hpp
14488 /*
14489 未完成的elc解释器_share文件
14490 由steve02081504与Alex0125设计、编写
14491 转载时请在不对此文件做任何修改的同时注明出处
14492 项目地址:https://github.com/steve02081504/ELC
14493 */
14494
14495 //每个bit(不是字节)的可能性
14496 //为什么c艹委员会不定义这个?
14497 #define BIT_POSSIBILITY 2
14498
14499 //file_end
14500
14501 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14502
14503 #if defined(_MSC_VER)
14504 #pragma warning(push,ELC_WARNING_LEVEL)
14505 #pragma warning(disable:4099)//class与struct混用警告diss
14506 #pragma warning(disable:26812)//enum class安利diss.
14507 #pragma warning(disable:4584)//重复子类警告diss
14508 #pragma warning(disable:4250)//域控制继承警告diss
14509 #pragma warning(disable:26432)//不完全默认方法警告diss
14510 #pragma warning(disable:26435)//virtual override方法警告diss
14511 #pragma warning(disable:26481)//容器安利diss
14512 #pragma warning(disable:26446)//gsl::at安利diss
14513 #pragma warning(disable:26434)//方法覆盖警告diss
14514 #pragma warning(disable:26429)//gsl::not_null安利diss
14515 #pragma warning(disable:26471)//对void*进行static_cast安利diss
14516 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
14517 #pragma warning(disable:26473)//相同指针显式cast警告diss
14518 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
14519 #pragma warning(disable:26485)//数组作指针警告diss
14520 #pragma warning(disable:26490)//reinterpret_cast警告diss
14521 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
14522 #pragma warning(disable:26482)//非常数数组索引警告diss
14523 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
14524 #endif
14525 #if defined(_MSC_VER)
14526 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
14527 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
14528 #define push_msvc_warning() __pragma(warning(push))
14529 #define pop_msvc_warning() __pragma(warning(pop))
14530 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
14531 #else
14532 #define suppress_msvc_warning(...)
14533 #define disable_msvc_warning(...)
14534 #define push_msvc_warning()
14535 #define pop_msvc_warning()
14536 #define push_and_disable_msvc_warning(...)
14537 #endif
14538 //
14539 #if defined(ELC_VOID_NAME)
14540 #undef void
14541 #endif
14542
14543 // #define often_noexcept
14544 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
14545 #define noexcept_as_auto MAGIC//哦现在有了
14546 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
14547 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
14548
14549 #define using_method_from_base_t(name,...) \
14550 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
14551 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
14552 {\
14553 return base_t::name(forward<Args>(rest)...);\
14554 }\
14555
14556 #define using_method_from_value(name,value_name,...) \
14557 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
14558 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
14559 {\
14560 return value_name.name(forward<Args>(rest)...);\
14561 }\
14562
14563 #define floop while(__builtin_is_my_dick_still_there())
14564 #define enable_adl(name) void name()noexcept=delete
14565
14566 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
14567 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
14568
14569 #define declvalue(...) (::std::declval<__VA_ARGS__>())
14570
14571 /*实例化到此将引发错误*/
14572 #define template_error(reason) static_assert(template_error_helper<T>,reason)
14573 /*实例化到此将引发警告*/
14574 #define template_warning(reason) template_warning_helper<T>(reason)
14575
14576 //for type_info
14577 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
14578 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
14579
14580 #define is_common_attribute(name) public attribute<T,name<T>>
14581 #define is_special_attribute(name) public attribute<T,name>
14582
14583 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
14584 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
14585
14586 //for float_size_t
14587 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
14588 //bitnum_of
14589 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
14590
14591 //for attribute
14592 #define def_common_attribute_with_nothing(name) \
14593 template<typename T>\
14594 class name{}\
14595
14596 #define def_special_attribute_with_nothing(name) \
14597 class name{}\
14598
14599 #define common_attribute_t template<class>class
14600 #define special_attribute_t class
14601
14602 /*
14603 若参数的布尔值为零,那么此模板不会实例化
14604
14605 为什么不用cpp20的constraints?
14606 1.不能类内定义
14607 2.不能作为模板参数
14608 一句话总结:c艹标准会sb
14609 */
14610 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
14611 /*默认参与模板候选*/
14612 #define enabled_by_default class enable_state=void
14613 /*默认不参与模板候选*/
14614 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
14615 /*若参数为病式,那么此模板不会实例化*/
14616 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
14617 /*用于模板声明*/
14618 #define enable_flag class enable_state
14619
14620 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
14621 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
14622 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
14623 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
14624 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
14625
14626 /*让lambda递归更加美观*/
14627 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
14628 /*让lambda递归更加美观*/
14629 #define get_recursive_lambda_caller(name) \
14630 lambda_with_catch(&)(auto&&...Args){\
14631 return name(name,Args...);\
14632 }
14633 /*让lambda定义更加美观*/
14634 #define lambda []
14635 /*让lambda定义更加美观*/
14636 #define lambda_with_catch(...) [__VA_ARGS__]
14637 /*让lambda递归更加美观*/
14638 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
14639 //recursive_lambda_self_referential_reserved_symbolname
14640 #define lambda_RLSRRS _my_jb_super_sb_name_
14641
14642 #define MAGIC//ahh,ko no tenno da!
14643
14644 /*装饰性语法糖*/
14645 #define nothing
14646
14647 /*aya风格语法糖*/
14648 #define elseif else if
14649 /*aya风格语法糖*/
14650 #define _big_than_ >
14651 /*aya风格语法糖*/
14652 #define _small_than_ <
14653
14654 #if defined(_MSC_VER)
14655 #define not !
14656 #define and &&
14657 #define or ||
14658 #endif
14659
14660 /*进入名称空间,并不是很美观*/
14661 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
14662 /*退出名称空间,并不是很美观*/
14663 #define BREAK_NAMESPACE }
14664
14665 /*template说明符*/
14666 #define template_name template
14667 /*template说明符*/
14668 #define type_name class
14669
14670 #if defined(DEBUG) || defined(_DEBUG)
14671 #define not_in_debug 0
14672 #else
14673 #define not_in_debug 1
14674 #endif
14675
14676 #define es U""
14677 #define ec(ch) U ## ch
14678
14679 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
14680 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
14681 #else
14682 #define ELC_TEST_EVENTNAME(name)
14683 #endif
14684
14685 #define override_instance_struct \
14686 protected:\
14687 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
14688 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
14689 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
14690 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
14691 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
14692
14693 #if defined(_WIN32)
14694 #define distinctive __declspec(dllexport)
14695 #else
14696 #define distinctive
14697 #endif
14698
14699 #if defined(_WIN32)
14700 #define force_inline __forceinline
14701 #elif defined(__GNUC__)
14702 #define force_inline __attribute__((always_inline)) inline
14703 #else
14704 #define force_inline inline
14705 #endif
14706
14707 #if defined(_WIN32)
14708 #define with_no_vtable __declspec(novtable)
14709 #else
14710 #define with_no_vtable
14711 #endif
14712
14713 #define in_consteval (::std::is_constant_evaluated())
14714
14715 #define no_vtable_struct struct with_no_vtable
14716 #define no_vtable_class class with_no_vtable
14717
14718 //file_end
14719
14720 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
14721
14722 //file_end
14723
14724 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
14725
14726 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/defs.hpp"
14727 //defs.hpp
14728 //at namespace elc::defs
14729 /*
14730 未完成的elc解释器string文件
14731 由steve02081504与Alex0125设计、编写
14732 转载时请在不对此文件做任何修改的同时注明出处
14733 项目地址:https://github.com/steve02081504/ELC
14734 */
14735 namespace string_n{
14736 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
14737 //_body.hpp
14738 //at namespace elc::defs::string_n
14739 /*
14740 未完成的elc解释器string文件
14741 由steve02081504与Alex0125设计、编写
14742 转载时请在不对此文件做任何修改的同时注明出处
14743 项目地址:https://github.com/steve02081504/ELC
14744 */
14745 inline namespace string_data_n{
14746 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_decl.hpp"
14747 //_decl.hpp
14748 //at namespace elc::defs::string_n::string_data_n
14749 /*
14750 未完成的elc解释器string文件
14751 由steve02081504与Alex0125设计、编写
14752 转载时请在不对此文件做任何修改的同时注明出处
14753 项目地址:https://github.com/steve02081504/ELC
14754 */
14755 template<typename char_T>
14756 struct base_string_data_t;
14757
14758 template<typename char_T>
14759 struct null_string_data_t;
14760 template<typename char_T>
14762
14763 template<typename char_T>
14764 struct comn_string_data_t;
14765
14766 template<typename char_T>
14767 struct substr_string_data_t;
14768
14769 template<typename char_T>
14771 template<typename char_T>
14773
14774 template<typename char_T>
14775 struct sum_string_data_t;
14776
14777 template<typename char_T>
14778 struct erased_string_data_t;
14779 template<typename char_T>
14781
14782 //template<typename char_T>
14783 //struct replaced_string_data_t;
14784
14785 template<typename char_T>
14787
14788 //file_end
14789
14790 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
14791
14792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/base_string_data_t.hpp"
14793 //base_string_data_t.hpp
14794 //at namespace elc::defs::string_n::string_data_n
14795 /*
14796 未完成的elc解释器string文件
14797 由steve02081504与Alex0125设计、编写
14798 转载时请在不对此文件做任何修改的同时注明出处
14799 项目地址:https://github.com/steve02081504/ELC
14800 */
14801 template<typename char_T>
14803 with_common_attribute<abstract_base,never_in_array,replace_able,ref_able>,build_by_get_only{
14805 typedef comn_ptr_t<this_t> ptr_t;
14807
14808 static_assert(noexcept(declvalue(ptr_t).operator*()));//貌似msvc在这里有bug
14809
14810 static constexpr bool copy_assign_nothrow=copy_assign.nothrow<char_T>;
14811 static constexpr bool copy_construct_nothrow=copy_construct.nothrow<char_T>;
14812 static constexpr bool move_construct_nothrow=move_construct.nothrow<char_T>;
14813 static constexpr bool construct_nothrow=construct<char_T>.nothrow<>;
14814 static constexpr bool destruct_nothrow=destruct.nothrow<char_T>;
14815 static constexpr bool clear_nothrow=destruct_nothrow;
14816 static constexpr bool ptr_reset_nothrow=destruct_nothrow;
14817 static constexpr bool hash_nothrow=hash.nothrow<char_T>;
14818 static constexpr bool get_data_nothrow=copy_construct_nothrow&&destruct_nothrow;
14819 static constexpr bool apply_data_nothrow=construct_nothrow&&copy_assign_nothrow;
14820
14821 friend class null_string_data_t<char_T>;
14822 friend class constexpr_string_data_t<char_T>;
14823 friend class comn_string_data_t<char_T>;
14824 friend class substr_string_data_t<char_T>;
14825 friend class head_apply_string_data_t<char_T>;
14826 friend class end_apply_string_data_t<char_T>;
14827 friend class sum_string_data_t<char_T>;
14828 friend class erased_string_data_t<char_T>;
14829 friend class inserted_string_data_t<char_T>;
14830 //friend class replaced_string_data_t<char_T>;
14831 friend class same_value_compress_string_data_t<char_T>;
14832
14833 base_string_data_t()noexcept=default;
14834 base_string_data_t(never_ref_num_zero_t)noexcept{ attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero(); }
14835
14836 [[nodiscard]]bool is_unique()noexcept{ return get_ref_num(this)==1; }
14837 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)=0;
14838
14839 virtual ~base_string_data_t()noexcept(destruct_nothrow)=default;
14840
14841 [[nodiscard]]virtual char_T* get_c_str(ptr_t&)noexcept(get_data_nothrow);
14842 [[nodiscard]]virtual const char_T* get_const_c_str(ptr_t&p)noexcept(get_data_nothrow){return get_c_str(p);}
14843 [[nodiscard]]virtual const char_T* get_data(ptr_t&p)noexcept(get_data_nothrow){return get_c_str(p);}//不要求以0结尾
14844 [[nodiscard]]virtual char_T* get_unique_c_str(ptr_t&)noexcept(get_data_nothrow);
14845 [[nodiscard]]virtual size_t get_size()noexcept=0;
14846 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept;
14847 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow);
14848 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow);
14849 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow);
14850 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow);
14851
14852 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow);
14853 [[nodiscard]]virtual ptr_t do_insert(size_t pos,ptr_t str)noexcept;
14854 [[nodiscard]]virtual ptr_t do_erase(size_t pos,size_t size)noexcept;
14855
14856 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow){
14857 const auto pos = this->get_size()-size;
14858 const auto before = get_substr_data(0,pos);
14859 const auto after = get_substr_data(pos,size);
14860 self = before;
14861 return after;
14862 }
14863 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow){
14864 const auto pos = size;
14865 const auto before = get_substr_data(0,pos);
14866 const auto after = get_substr_data(pos,this->get_size()-size);
14867 self = after;
14868 return before;
14869 }
14870 /*
14871 TODO:
14872
14873 find
14874 rfind
14875 find_first_of
14876 find_first_not_of
14877 find_last_of
14878 find_last_not_of
14879
14880 starts_with
14881 ends_with
14882 contains
14883 replace
14884 */
14886 protected:
14887 bool same_type(ptr_t a)noexcept{return typeid(*this)==typeid(*a);}
14888 [[nodiscard]]virtual bool same_struct(ptr_t)noexcept=0;
14889 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)=0;
14890 [[nodiscard]]virtual compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)=0;
14891 protected:
14893 public:
14894 [[nodiscard]]bool equal_with(ptr_t with)noexcept(equal.nothrow<char_T>){
14895 //eq->equal优化
14896 if(this==with)
14897 return true;
14898 //hash_diff->not_equal优化
14899 if(this->has_hash_cache()&&with->has_hash_cache())
14900 if(this->get_hash_cache()!=with->get_hash_cache())
14901 return false;
14902 //size比较优化被移至string_t实现内部:原因:same_struct_compare大部分情况下size相同。
14903 //快速比较结束,实际比较段
14904 {
14905 suppress_msvc_warning(26494)//未初始化警告diss
14906 bool aret;
14907 {
14908 //同结构比较优化比较方式
14909 if(same_type(with)&&same_struct(with))
14910 aret=same_struct_equal(with);
14911 //否则默认比较
14912 else
14913 aret=default_equal_method(with);
14914 }
14915 //如果equal,则eq处理
14916 if(aret)
14917 equivalent_optimization(this,with);
14918 return aret;
14919 }
14920 }
14921 protected:
14922 [[nodiscard]]bool default_equal_method(ptr_t with)noexcept(equal.nothrow<char_T>){
14923 const size_t self_size=get_size();
14924 return equal_with(with,0,self_size);
14925 }
14926 public:
14927 [[nodiscard]]bool equal_with(ptr_t with,size_t pos,size_t size)noexcept(equal.nothrow<char_T>){
14928 //eq->equal优化
14929 if(this==with)
14930 return true;
14931 size_t index=pos;
14932 auto a=this->get_the_largest_complete_data_block_begin_form(index);
14933 auto b=with->get_the_largest_complete_data_block_begin_form(index);
14934 while(size){
14935 const size_t step=min({a.size(),b.size(),size});
14936 if(a.begin()!=b.begin())//起始地址不同时才需要真的比较
14937 if(!equal(a.begin(),b.begin(),step))
14938 return false;
14939 index+=step;
14940 size-=step;
14941 if(a.size()==step)
14942 a=this->get_the_largest_complete_data_block_begin_form(index);
14943 else
14944 a={a.begin()+step,note::size(a.size()-step)};
14945 if(b.size()==step)
14946 b=with->get_the_largest_complete_data_block_begin_form(index);
14947 else
14948 b={b.begin()+step,note::size(b.size()-step)};
14949 if(!a.size()&&!b.size())
14950 return a.size()==b.size();
14951 }
14952 return true;
14953 }
14954 [[nodiscard]]bool equal_with(string_view_t with)noexcept(equal.nothrow<char_T>){
14955 size_t size=with.size();
14956 size_t index=0;
14957 auto a=this->get_the_largest_complete_data_block_begin_form(index);
14958 if(a.begin()==with.begin() && a.size()==with.size())
14959 return true;
14960 floop{
14961 auto b=with.begin()+index;
14962 const size_t step=min({a.size(),with.size()-index,size});
14963 if(!equal(a.begin(),b,step))
14964 return false;
14965 index+=step;
14966 size-=step;
14967 if(a.size()==step)
14968 a=this->get_the_largest_complete_data_block_begin_form(index);
14969 else
14970 a={a.begin()+step,note::size(a.size()-step)};
14971 if(!a.size()||!size)
14972 return a.size()==size;
14973 }
14974 }
14975 [[nodiscard]]bool equal_with(const char_T*with)noexcept(equal.nothrow<char_T>){
14976 size_t size=get_size();
14977 size_t index=0;
14978 auto a=this->get_the_largest_complete_data_block_begin_form(index);
14979 if(a.begin()==with && with[a.size()]==char_T{})
14980 return true;
14981 floop{
14982 auto b=with+index;
14983 if(!*b)
14984 return false;
14985 size_t step=min({a.size(),size});
14986 if(!equal(a.begin(),step,just_an_part,b,end_by_zero))
14987 return false;
14988 index+=step;
14989 size-=step;
14990 if(a.size()==step)
14991 a=this->get_the_largest_complete_data_block_begin_form(index);
14992 else
14993 a={a.begin()+step,note::size(a.size()-step)};
14994 if(!*(b+step))
14995 return !a.size();
14996 if(!a.size())
14997 return !*(b+step);
14998 }
14999 }
15000 public:
15001 [[nodiscard]]compare_type compare_with(ptr_t with)noexcept(compare.nothrow<char_T>){
15002 //eq->equal优化
15003 if(this==with)
15004 return strong_ordering::equivalent;
15005 //size比较优化被移至string_t实现内部:原因:same_struct_compare大部分情况下size相同。
15006 //快速比较结束,实际比较段
15007 {
15008 suppress_msvc_warning(26494)//未初始化警告diss
15009 compare_type aret;
15010 {
15011 //同结构比较优化比较方式
15012 if(same_type(with)&&same_struct(with))
15013 aret=same_struct_compare(with);
15014 //否则默认比较
15015 else
15016 aret=default_compare_method(with);
15017 }
15018 //如果equal,则eq处理
15019 if(aret==0)
15020 equivalent_optimization(this,with);
15021 return aret;
15022 }
15023 }
15024 protected:
15025 [[nodiscard]]compare_type default_compare_method(ptr_t with)noexcept(compare.nothrow<char_T>){
15026 const size_t self_size=get_size();
15027 return compare_with(with,0,self_size);
15028 }
15029 public:
15030 [[nodiscard]]compare_type compare_with(ptr_t with,size_t pos,size_t size)noexcept(compare.nothrow<char_T>){
15031 //eq->equal优化
15032 if(this==with)
15033 return strong_ordering::equivalent;
15034 size_t index=pos;
15035 auto a=this->get_the_largest_complete_data_block_begin_form(index);
15036 auto b=with->get_the_largest_complete_data_block_begin_form(index);
15037 while(size){
15038 const size_t step=min({a.size(),b.size(),size});
15039 if(a.begin()!=b.begin())//起始地址不同时才需要真的比较
15040 if(auto tmp=compare(a.begin(),b.begin(),step); tmp!=0)
15041 return tmp;
15042 index+=step;
15043 size-=step;
15044 if(a.size()==step)
15045 a=this->get_the_largest_complete_data_block_begin_form(index);
15046 else
15047 a={a.begin()+step,note::size(a.size()-step)};
15048 if(b.size()==step)
15049 b=with->get_the_largest_complete_data_block_begin_form(index);
15050 else
15051 b={b.begin()+step,note::size(b.size()-step)};
15052 if(!a.size()||!b.size())
15053 return a.size()<=>b.size();
15054 }
15055 return strong_ordering::equivalent;
15056 }
15057 [[nodiscard]]compare_type compare_with(string_view_t with)noexcept(compare.nothrow<char_T>){
15058 size_t size=with.size();
15059 size_t index=0;
15060 auto a=this->get_the_largest_complete_data_block_begin_form(index);
15061 if(a.begin()==with.begin() && a.size()==with.size())
15062 return strong_ordering::equivalent;
15063 floop{
15064 auto b=with.begin()+index;
15065 size_t step=min({a.size(),with.size()-index,size});
15066 if(auto tmp=compare(a.begin(),b,step); tmp!=0)
15067 return tmp;
15068 index+=step;
15069 size-=step;
15070 if(a.size()==step)
15071 a=this->get_the_largest_complete_data_block_begin_form(index);
15072 else
15073 a={a.begin()+step,note::size(a.size()-step)};
15074 if(!a.size()||!size)
15075 return a.size()<=>size;
15076 }
15077 }
15078 [[nodiscard]]compare_type compare_with(const char_T*with)noexcept(compare.nothrow<char_T>){
15079 size_t size=get_size();
15080 size_t index=0;
15081 auto a=this->get_the_largest_complete_data_block_begin_form(index);
15082 if(a.begin()==with && with[a.size()]==char_T{})
15083 return strong_ordering::equivalent;
15084 floop{
15085 auto b=with+index;
15086 if(!*b)
15087 return strong_ordering::greater;
15088 size_t step=min({a.size(),size});
15089 if(auto tmp=compare(a.begin(),step,just_an_part,b,end_by_zero); tmp!=0)
15090 return tmp;
15091 index+=step;
15092 size-=step;
15093 if(a.size()==step)
15094 a=this->get_the_largest_complete_data_block_begin_form(index);
15095 else
15096 a={a.begin()+step,note::size(a.size()-step)};
15097 if(!a.size())
15098 return *(with+index)==char_T{}? strong_ordering::equivalent:
15099 strong_ordering::less;
15100 if(!*(with+index))
15101 return strong_ordering::greater;
15102 }
15103 }
15104 protected:
15105 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)=0;
15106 public:
15107 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)=0;
15108 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)=0;
15109 protected:
15110 hash_t _hash_cache{};
15111 bool _has_hash_cache=false;
15112 bool has_hash_cache()noexcept{return _has_hash_cache;}
15113 void reset_hash_cache()noexcept{_has_hash_cache=false;}
15114 hash_t get_hash_cache()noexcept{return _hash_cache;}
15115 hash_t set_hash_cache(hash_t value)noexcept{_has_hash_cache=true;return _hash_cache=value;}
15116 public:
15117 hash_t get_hash(ptr_t&p)noexcept(hash_nothrow){
15118 if(has_hash_cache())
15119 return get_hash_cache();
15120 else{
15121 const auto tmp=this->get_hash_detail(p);
15122 return p->set_hash_cache(tmp);
15123 }
15124 }
15125 protected:
15126 virtual hash_t get_hash_detail(ptr_t&p)noexcept(hash_nothrow){
15127 const auto size=get_size();
15128 const auto data=get_data(p);
15129 return hash(data,size);
15130 }
15131 public:
15132 hash_t get_others_hash_with_calculated_before(hash_t before,size_t before_size,ptr_t&p,size_t pos,size_t size)noexcept(hash_nothrow){
15133 if(pos==0&&size==get_size())
15134 return hash.merge_array_hash_results(before,before_size,get_hash(p),size);
15135 return this->get_others_hash_with_calculated_before_detail(before,before_size,p,pos,size);
15136 }
15137 protected:
15138 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&p,size_t pos,size_t size)noexcept(hash_nothrow){
15139 return hash.with_calculated_before(before,before_size,get_data(p)+pos,size);
15140 }
15141 protected:
15142 void self_changed()noexcept{
15143 reset_hash_cache();
15144 }
15145 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept=0;
15146 public:
15147 [[nodiscard]]float_size_t get_memory_cost()noexcept{
15148 return get_base_memory_cost()/get_ref_num(this);
15149 }
15150 [[nodiscard]]float_size_t get_memory_cost_after_gc()noexcept;
15151 [[nodiscard]]float_size_t get_gc_profit()noexcept{return get_memory_cost()-get_memory_cost_after_gc();}
15152 [[nodiscard]]bool positive_gc_profit()noexcept{return get_gc_profit() > 0;}
15153 //for gc:
15154 /*
15155 [[nodiscard]]virtual bool gc()=0{
15156 bool need_be_replace=get_gc_profit()>=0
15157 if(need_be_replace)
15158 this->be_replace_as(get<comn_string_data_t>(this));
15159 return need_be_replace;
15160 }
15161 */
15162
15163 [[nodiscard]]virtual const range_n::match_pattern<const char_T>& get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow);
15164 [[nodiscard]]virtual const range_n::reverse_match_pattern<const char_T>& get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow);
15165
15166 protected:
15167 static inline void be_replace(this_t* a,ptr_t b)noexcept(ptr_reset_nothrow){
15168 a->be_replace_as(b);
15169 }
15170 static inline void be_replace(ptr_t& a,ptr_t b)noexcept(ptr_reset_nothrow){
15171 a.do_replace(b);
15172 }
15173 static inline void equivalent_optimization(auto&& a,auto&& b)noexcept(ptr_reset_nothrow){
15174 if(a->get_memory_cost() >= b->get_memory_cost())
15175 be_replace(a,b);
15176 else
15177 be_replace(b,a);
15178 }
15179 };
15180 template<typename char_T>
15181 void base_string_data_t<char_T>::be_replace_as(ptr_t a)noexcept(clear_nothrow){
15183 }
15184
15185 //file_end
15186
15187 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15188
15189 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/null_string_data_t.hpp"
15190 //null_string_data_t.hpp
15191 //at namespace elc::defs::string_n::string_data_n
15192 /*
15193 未完成的elc解释器string文件
15194 由steve02081504与Alex0125设计、编写
15195 转载时请在不对此文件做任何修改的同时注明出处
15196 项目地址:https://github.com/steve02081504/ELC
15197 */
15198 template<typename char_T>
15199 struct null_string_data_t final:base_string_data_t<char_T>,instance_struct<null_string_data_t<char_T>>{
15202 using base_t::ptr_t;
15204
15205 using base_t::copy_assign_nothrow;
15206 using base_t::copy_construct_nothrow;
15207 using base_t::move_construct_nothrow;
15208 using base_t::construct_nothrow;
15209 using base_t::destruct_nothrow;
15210 using base_t::clear_nothrow;
15211 using base_t::ptr_reset_nothrow;
15212 using base_t::hash_nothrow;
15213 using base_t::get_data_nothrow;
15214 using base_t::apply_data_nothrow;
15215 using base_t::set_hash_cache;
15216
15217 null_string_data_t()noexcept:base_t(never_ref_num_zero){}
15218
15219 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{nothing;}
15220 [[nodiscard]]virtual char_T* get_c_str(ptr_t&)noexcept override final{
15221 static char_T data[1]{};
15222 return data;
15223 }
15224 [[nodiscard]]virtual size_t get_size()noexcept override final{ return 0; }
15225 [[nodiscard]]virtual ptr_t get_substr_data([[maybe_unused]]size_t begin,[[maybe_unused]]size_t size)noexcept override final{ return this; }
15226 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{ return get<comn_string_data_t<char_T>>(str); }
15227 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{ return str; }
15228 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{ return get<comn_string_data_t<char_T>>(str); }
15229 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept override final{ return str; }
15230
15231 [[nodiscard]]virtual ptr_t do_insert([[maybe_unused]]size_t pos,[[maybe_unused]]string_view_t str)noexcept(construct_nothrow&&copy_assign_nothrow)override final{ return get<comn_string_data_t<char_T>>(str); }
15232 [[nodiscard]]virtual ptr_t do_insert([[maybe_unused]]size_t pos,[[maybe_unused]]ptr_t str)noexcept override final{ return str; }
15233 [[nodiscard]]virtual ptr_t do_erase([[maybe_unused]]size_t pos,[[maybe_unused]]size_t size)noexcept override final{ return this; }
15234 protected:
15235 virtual void copy_part_data_to([[maybe_unused]]char_T* to,[[maybe_unused]]size_t pos,[[maybe_unused]]size_t size)noexcept override final{ return; }
15236 public:
15237 [[nodiscard]]virtual char_T arec([[maybe_unused]]size_t index)noexcept override final{ return char_T{}; }
15238 virtual void arec_set([[maybe_unused]]size_t index,[[maybe_unused]]char_T a,[[maybe_unused]]ptr_t& p)noexcept override final{ nothing; }
15239 [[nodiscard]]virtual ptr_t do_pop_back([[maybe_unused]]size_t size,[[maybe_unused]]ptr_t& self)noexcept override final{ return this; }
15240 [[nodiscard]]virtual ptr_t do_pop_front([[maybe_unused]]size_t size,[[maybe_unused]]ptr_t& self)noexcept override final{ return this; }
15241 protected:
15242 virtual hash_t get_hash_detail([[maybe_unused]]ptr_t&p)noexcept override final{ return hash(nothing); }
15243 virtual hash_t get_others_hash_with_calculated_before_detail([[maybe_unused]]hash_t before,[[maybe_unused]]size_t before_size,[[maybe_unused]]ptr_t&p,[[maybe_unused]]size_t pos,[[maybe_unused]]size_t size)noexcept override final{ return before; }
15244 protected:
15245 [[nodiscard]]virtual bool same_struct(ptr_t)noexcept override final{return false;}
15246 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form([[maybe_unused]]size_t begin)noexcept override final{return {0,0};}
15247 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept override final{return false;}
15248 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept override final{return strong_ordering::equivalent;}
15249 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{return 0;}
15250 };
15251 template<typename char_T>
15253 template<typename char_T>
15254 base_string_data_t<char_T>* the_get_null_ptr(const base_string_data_t<char_T>*)noexcept{ return&null_string_data<char_T>; }
15255
15256 //file_end
15257
15258 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15259 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/constexpr_string_data_t.hpp"
15260 //constexpr_string_data_t.hpp
15261 //at namespace elc::defs::string_n::string_data_n
15262 /*
15263 未完成的elc解释器string文件
15264 由steve02081504与Alex0125设计、编写
15265 转载时请在不对此文件做任何修改的同时注明出处
15266 项目地址:https://github.com/steve02081504/ELC
15267 */
15268 template<typename char_T>
15269 struct constexpr_string_data_t final:base_string_data_t<char_T>,instance_struct<constexpr_string_data_t<char_T>>{
15272 using base_t::ptr_t;
15274
15275 using base_t::copy_assign_nothrow;
15276 using base_t::copy_construct_nothrow;
15277 using base_t::move_construct_nothrow;
15278 using base_t::construct_nothrow;
15279 using base_t::destruct_nothrow;
15280 using base_t::clear_nothrow;
15281 using base_t::ptr_reset_nothrow;
15282 using base_t::hash_nothrow;
15283 using base_t::get_data_nothrow;
15284 using base_t::apply_data_nothrow;
15285 using base_t::set_hash_cache;
15286
15287 const char_T* _m;
15288 size_t _size;
15289
15290 const range_n::match_pattern<const char_T>* _p_match_pattern = nullptr;
15291 const range_n::reverse_match_pattern<const char_T>* _p_reverse_match_pattern = nullptr;
15292 bool match_pattern_by_get = 0;
15293
15294 void clear_match_pattern()noexcept{
15295 if(match_pattern_by_get){
15296 unget(remove_const(_p_match_pattern));
15297 unget(remove_const(_p_reverse_match_pattern));
15298 _p_match_pattern = nullptr;
15299 _p_reverse_match_pattern = nullptr;
15300 }
15301 }
15302
15304 _m=str.begin();
15305 _size=str.size();
15306 set_hash_cache(hash(str));
15307 _p_match_pattern=&str.match_pattern;
15308 _p_reverse_match_pattern=&str.reverse_match_pattern;
15309 match_pattern_by_get=0;
15310 }
15312 _m=str.begin();
15313 _size=str.size();
15314 if(!_size)
15315 be_replace_as(null_ptr);
15316 }
15317 virtual ~constexpr_string_data_t()noexcept(destruct_nothrow)override final{
15318 clear_match_pattern();
15319 }
15320
15321 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
15322 return get<this_t>(string_view_t{_m+begin,size});
15323 }
15324 [[nodiscard]]virtual const char_T* get_data(ptr_t&)noexcept(get_data_nothrow)override final{return _m;}
15325 [[nodiscard]]virtual const char_T* get_const_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15326 if(!_m[_size])
15327 return _m;
15328 else
15329 return base_t::get_const_c_str(p);
15330 }
15331 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _size; }
15332 protected:
15333 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{ copy_assign[size](note::from(_m+pos),note::to(to)); }
15334 public:
15335 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{ return _m[index]; }
15336
15337 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{base_t::be_replace_as(a);}
15338 virtual void arec_set(size_t index,char_T a,ptr_t&p)noexcept override final{base_t::arec_set(index,a,p);}
15339
15340 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
15341 return true;//总size被保证一样
15342 }
15343 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{return {&_m[begin],note::size(_size-begin)};}
15344 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15345 auto wp=down_cast<this_t*>(with.get());
15346 if(_m==wp->_m)
15347 return true;
15348 return equal(_m,wp->_m,_size);
15349 }
15350 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15351 auto wp=down_cast<this_t*>(with.get());
15352 if(_m==wp->_m)
15353 return strong_ordering::equivalent;
15354 return compare(_m,wp->_m,_size);
15355 }
15356 protected:
15357 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15358 return float_size_of(*this);
15359 }
15360 public:
15361 [[nodiscard]]virtual const range_n::match_pattern<const char_T>& get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15362 if(!_p_match_pattern){
15363 _p_match_pattern=get<range_n::match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15364 match_pattern_by_get = 1;
15365 }
15366 return *_p_match_pattern;
15367 }
15368 [[nodiscard]]virtual const range_n::reverse_match_pattern<const char_T>&get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15369 if(!_p_reverse_match_pattern){
15370 _p_reverse_match_pattern=get<range_n::reverse_match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15371 match_pattern_by_get = 1;
15372 }
15373 return *_p_reverse_match_pattern;
15374 }
15375 };
15376
15377 //file_end
15378
15379 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15380
15381 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/comn_string_data_t.hpp"
15382 //comn_string_data_t.hpp
15383 //at namespace elc::defs::string_n::string_data_n
15384 /*
15385 未完成的elc解释器string文件
15386 由steve02081504与Alex0125设计、编写
15387 转载时请在不对此文件做任何修改的同时注明出处
15388 项目地址:https://github.com/steve02081504/ELC
15389 */
15390 template<typename char_T>
15391 struct comn_string_data_t final:base_string_data_t<char_T>,instance_struct<comn_string_data_t<char_T>>{
15394 using base_t::ptr_t;
15396 using base_t::self_changed;
15397
15398 using base_t::copy_assign_nothrow;
15399 using base_t::copy_construct_nothrow;
15400 using base_t::move_construct_nothrow;
15401 using base_t::construct_nothrow;
15402 using base_t::destruct_nothrow;
15403 using base_t::clear_nothrow;
15404 using base_t::ptr_reset_nothrow;
15405 using base_t::hash_nothrow;
15406 using base_t::get_data_nothrow;
15407 using base_t::apply_data_nothrow;
15408 using base_t::set_hash_cache;
15409
15410 array_t<char_T> _m;
15411 range_n::match_pattern<const char_T>* _p_match_pattern = nullptr;
15412 range_n::reverse_match_pattern<const char_T>* _p_reverse_match_pattern = nullptr;
15413 void clear_match_pattern()noexcept{
15414 unget(_p_match_pattern);
15415 unget(_p_reverse_match_pattern);
15416 base_t::self_changed();
15417 }
15418 void self_changed()noexcept{
15419 clear_match_pattern();
15420 base_t::self_changed();
15421 }
15422
15423 comn_string_data_t(string_view_t str)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(str.size()+1)){
15424 copy_assign[str.size()](note::from(str.begin()),note::to((char_T*)_m));
15425 _m[str.size()]=zero;
15426 }
15427 comn_string_data_t(ptr_t str)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(str->get_size()+1)){
15428 auto size=this->get_size();
15429 str->copy_part_data_to((char_T*)_m,0,size);
15430 _m[size]=zero;
15431 }
15432 comn_string_data_t(ptr_t str,size_t pos,size_t size)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(size+1)){
15433 str->copy_part_data_to((char_T*)_m,pos,size);
15434 _m[size]=zero;
15435 }
15436 comn_string_data_t(size_t size,char_T ch)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(size+1),ch){
15437 _m[size]=zero;
15438 }
15439 comn_string_data_t(size_t size)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(size+1)){
15440 _m[size]=zero;
15441 }
15442
15443 virtual ~comn_string_data_t()noexcept(destruct_nothrow)override final{
15444 clear_match_pattern();
15445 }
15446
15447 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
15448 _m.clear();
15449 base_t::be_replace_as(a);
15450 }
15451 [[nodiscard]]virtual char_T* get_c_str(ptr_t&)noexcept override final{ return (char_T*)_m; }
15452 [[nodiscard]]virtual char_T* get_unique_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15453 if(this->is_unique())
15454 return (char_T*)_m;
15455 else
15456 return base_t::get_unique_c_str(p);
15457 }
15458 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _m.size()-1; }
15459 protected:
15460 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{ copy_assign[size](note::from((const char_T*)_m+pos),note::to(to)); }
15461 public:
15462 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{ return _m[index]; }
15463 virtual void arec_set(size_t index,char_T a,ptr_t&p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15464 if(this->is_unique()){
15465 copy_assign(_m[index],a);
15466 self_changed();
15467 }
15468 else
15469 base_t::arec_set(index,a,p);
15470 }
15471
15472 [[nodiscard]]virtual bool same_struct(ptr_t)noexcept override final{
15473 return true;//总size被保证一样
15474 }
15475 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{return {&_m[begin],note::size(get_size()-begin)};}
15476 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15477 auto wp=down_cast<this_t*>(with.get());
15478 return equal(_m, wp->_m);
15479 }
15480 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15481 auto wp=down_cast<this_t*>(with.get());
15482 return compare(_m, wp->_m);
15483 }
15484 protected:
15485 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15486 return float_size_of(*this) + _m.size_in_byte();
15487 }
15488 public:
15489 [[nodiscard]]virtual const range_n::match_pattern<const char_T>& get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15490 if(!_p_match_pattern){
15491 _p_match_pattern=get<range_n::match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15492 }
15493 return *_p_match_pattern;
15494 }
15495 [[nodiscard]]virtual const range_n::reverse_match_pattern<const char_T>&get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15496 if(!_p_reverse_match_pattern){
15497 _p_reverse_match_pattern=get<range_n::reverse_match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15498 }
15499 return *_p_reverse_match_pattern;
15500 }
15501 };
15502 template<typename char_T>
15503 [[nodiscard]]char_T* base_string_data_t<char_T>::get_c_str(ptr_t&a)noexcept(get_data_nothrow){
15504 auto comn_data=get<comn_string_data_t<char_T>>(this);
15505 if(positive_gc_profit())
15506 a.do_replace(comn_data);
15507 else
15508 a=comn_data;
15509 return comn_data->get_c_str(a);
15510 }
15511 template<typename char_T>
15512 [[nodiscard]]char_T* base_string_data_t<char_T>::get_unique_c_str(ptr_t&a)noexcept(get_data_nothrow){
15513 auto comn_data=get<comn_string_data_t<char_T>>(this);
15514 a=comn_data;
15515 return comn_data->get_c_str(a);
15516 }
15517 template<typename char_T>
15518 void base_string_data_t<char_T>::arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow){
15519 copy_assign(this->get_unique_c_str(p)[index],a);
15520 }
15521 template<typename char_T>
15523 const auto size_of_base_array=this->get_size()*sizeof(char_T);
15524 const auto size=float_size_of(comn_string_data_t<char_T>)+size_of_base_array;
15525 return size/get_ref_num(this);
15526 }
15527 template<typename char_T>
15528 [[nodiscard]]const range_n::match_pattern<const char_T>& base_string_data_t<char_T>::get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow){
15529 auto comn_data=get<comn_string_data_t<char_T>>(this);
15530 self=comn_data;
15531 return comn_data->get_match_pattern_from_self(self);
15532 }
15533 template<typename char_T>
15534 [[nodiscard]]const range_n::reverse_match_pattern<const char_T>& base_string_data_t<char_T>::get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow){
15535 auto comn_data=get<comn_string_data_t<char_T>>(this);
15536 self=comn_data;
15537 return comn_data->get_reverse_match_pattern_from_self(self);
15538 }
15539
15540 //file_end
15541
15542 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15543
15544 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/substr_string_data_t.hpp"
15545 //substr_string_data_t.hpp
15546 //at namespace elc::defs::string_n::string_data_n
15547 /*
15548 未完成的elc解释器string文件
15549 由steve02081504与Alex0125设计、编写
15550 转载时请在不对此文件做任何修改的同时注明出处
15551 项目地址:https://github.com/steve02081504/ELC
15552 */
15553 template<typename char_T>
15554 struct substr_string_data_t final:base_string_data_t<char_T>,instance_struct<substr_string_data_t<char_T>>{
15557 using base_t::ptr_t;
15559 using base_t::self_changed;
15560
15561 using base_t::copy_assign_nothrow;
15562 using base_t::copy_construct_nothrow;
15563 using base_t::move_construct_nothrow;
15564 using base_t::construct_nothrow;
15565 using base_t::destruct_nothrow;
15566 using base_t::clear_nothrow;
15567 using base_t::ptr_reset_nothrow;
15568 using base_t::hash_nothrow;
15569 using base_t::get_data_nothrow;
15570 using base_t::apply_data_nothrow;
15571 using base_t::set_hash_cache;
15572
15576
15578 if(!_sub_size)
15579 be_replace_as(null_ptr);
15580 }
15581
15582 substr_string_data_t(ptr_t str,size_t sub_begin,size_t sub_size)noexcept:_to(str),_sub_begin(sub_begin),_sub_size(sub_size){
15583 null_equivalent_check();
15584 }
15585
15586 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
15587 _to.reset();
15588 base_t::be_replace_as(a);
15589 }
15590 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{ return get<substr_string_data_t<char_T>>(_to,begin+_sub_begin,size); }
15591 [[nodiscard]]virtual const char_T* get_const_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15592 if(_sub_begin+_sub_size==_to->get_size())
15593 return _to->get_const_c_str(_to)+_sub_begin;
15594 else
15595 return base_t::get_const_c_str(p);
15596 }
15597 [[nodiscard]]virtual const char_T* get_data(ptr_t&)noexcept(get_data_nothrow)override final{ return _to->get_data(_to)+_sub_begin; }
15598 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _sub_size; }
15599 protected:
15600 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{ _to->copy_part_data_to(to,pos+_sub_begin,size); }
15601 public:
15602 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{ return _to->arec(index+_sub_begin); }
15603 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15604 if(this->is_unique()){
15605 _to->arec_set(index+_sub_begin,a,_to);
15606 self_changed();
15607 }
15608 else
15609 base_t::arec_set(index,a,p);
15610 }
15611 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15612 if(this->is_unique() && _sub_begin==0){
15613 _to=_to->apply_str_to_begin(str);
15614 _sub_size+=str.size();
15615 self_changed();
15616 return this;
15617 }
15618 else
15619 return base_t::apply_str_to_begin(str);
15620 }
15621 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
15622 if(this->is_unique() && _sub_begin==0){
15623 _to=_to->apply_str_to_begin(str);
15624 _sub_size+=str->get_size();
15625 self_changed();
15626 return this;
15627 }
15628 else
15629 return base_t::apply_str_to_begin(str);
15630 }
15631 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15632 if(this->is_unique() && _sub_begin+_sub_size==_to->get_size()){
15633 _to=_to->apply_str_to_end(str);
15634 _sub_size+=str.size();
15635 self_changed();
15636 return this;
15637 }
15638 else
15639 return base_t::apply_str_to_end(str);
15640 }
15641 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
15642 if(this->is_unique() && _sub_begin+_sub_size==_to->get_size()){
15643 _to=_to->apply_str_to_end(str);
15644 _sub_size+=str->get_size();
15645 self_changed();
15646 return this;
15647 }
15648 else
15649 return base_t::apply_str_to_end(str);
15650 }
15651 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15652 if(this->is_unique() && _sub_begin==0){
15653 auto aret=_to->do_pop_front(size,_to);
15654 _sub_size-=size;
15655 null_equivalent_check();
15656 self_changed();
15657 return aret;
15658 }
15659 else
15660 return base_t::do_pop_front(size,self);
15661 }
15662 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15663 if(this->is_unique() && _sub_begin+_sub_size==_to->get_size()){
15664 auto aret=_to->do_pop_back(size,_to);
15665 _sub_size-=size;
15666 null_equivalent_check();
15667 self_changed();
15668 return aret;
15669 }
15670 else
15671 return base_t::do_pop_back(size,self);
15672 }
15673 protected:
15674 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
15675 auto result=hash(nothing);
15676 result=_to->get_others_hash_with_calculated_before(result,0,_to,_sub_begin,_sub_size);
15677 return result;
15678 }
15679 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
15680 return _to->get_others_hash_with_calculated_before(before,before_size,_to,pos+_sub_begin,size);
15681 }
15682 protected:
15683 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
15684 auto wp = down_cast<this_t*>(with.get());
15685 return _sub_begin == wp->_sub_begin;//总size被保证一样
15686 }
15687 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
15688 auto result = _to->get_the_largest_complete_data_block_begin_form(_sub_begin+begin);
15689 auto size = min(result.size(),_sub_size-begin);
15690 return {result.begin(), note::size(size)};
15691 }
15692 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15693 auto wp=down_cast<this_t*>(with.get());
15694 return _to->equal_with(wp->_to,_sub_begin,_sub_size);
15695 }
15696 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15697 auto wp=down_cast<this_t*>(with.get());
15698 return _to->compare_with(wp->_to,_sub_begin,_sub_size);
15699 }
15700 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15701 return float_size_of(*this)+_to->get_memory_cost();
15702 }
15703 };
15704 template<typename char_T>
15706 if(begin==0&&size==get_size())
15707 return this;
15708 else
15709 return get<substr_string_data_t<char_T>>(this,begin,size);
15710 }
15711
15712 //file_end
15713
15714 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15715
15716 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/head_apply_string_data_t.hpp"
15717 //end_apply_string_data_t.hpp
15718 //at namespace elc::defs::string_n::string_data_n
15719 /*
15720 未完成的elc解释器string文件
15721 由steve02081504与Alex0125设计、编写
15722 转载时请在不对此文件做任何修改的同时注明出处
15723 项目地址:https://github.com/steve02081504/ELC
15724 */
15725 template<typename char_T>
15726 struct head_apply_string_data_t final:base_string_data_t<char_T>,instance_struct<head_apply_string_data_t<char_T>>{
15729 using base_t::ptr_t;
15731 using base_t::self_changed;
15732
15733 using base_t::copy_assign_nothrow;
15734 using base_t::copy_construct_nothrow;
15735 using base_t::move_construct_nothrow;
15736 using base_t::construct_nothrow;
15737 using base_t::destruct_nothrow;
15738 using base_t::clear_nothrow;
15739 using base_t::ptr_reset_nothrow;
15740 using base_t::hash_nothrow;
15741 using base_t::get_data_nothrow;
15742 using base_t::apply_data_nothrow;
15743 using base_t::set_hash_cache;
15744
15745 array_t<char_T> _m;//意义为向前延续的数组:当需要向前附加内容时向前拓展以避免重新分配内存
15747 size_t _to_size;
15749
15750 head_apply_string_data_t(ptr_t str,string_view_t head)noexcept(construct_nothrow&&copy_assign_nothrow):
15751 _to_size(str->get_size()),
15752 _used_size(head.size()),
15753 _to(str)
15754 {
15755 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
15756 copy_assign[_used_size](note::from<const char_T*>(head.begin()),note::to<char_T*>(_m.end()-_used_size));
15757 }
15758
15759 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
15760 if(begin>=_used_size)
15761 return _to->get_substr_data(begin-_used_size,size);
15762 else
15763 return base_t::get_substr_data(begin,size);
15764 }
15765 [[nodiscard]]virtual char_T* get_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15766 if(!_used_size)
15767 return _to->get_c_str(_to);
15768 else
15769 return base_t::get_c_str(p);
15770 }
15771 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
15772 if(type_info<this_t> == typeid(*a)){
15773 const auto p = down_cast<this_t*>(a.get());
15774 if(_used_size==p->_used_size && _to!=p->_to)
15775 base_t::equivalent_optimization(_to, p->_to);
15776 }
15777 _m.clear();
15778 _to.reset();
15779 base_t::be_replace_as(a);
15780 }
15781 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _used_size+_to_size; }
15782 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow)override final{
15783 if(pos==0)
15784 return this->apply_str_to_begin(str);
15785 elseif(pos==get_size())
15786 return this->apply_str_to_end(str);
15787 elseif(this->is_unique()){
15788 if(pos<_used_size){
15789 if(_m.size()-_used_size<str.size()){
15790 const auto size_now=this->get_size()+str.size();
15791 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
15792 _m.insert_with_forward_resize(pos,str.size(),str.begin(),size_new);
15793 }
15794 else{
15795 char_T* orogin_head_begin=_m.end()-_used_size;
15796 char_T* head_begin=orogin_head_begin-str.size();
15797 copy_assign[pos](note::from<const char_T*>(orogin_head_begin),note::to<char_T*>(head_begin));
15798 copy_assign[str.size()](note::from<const char_T*>(str.begin()),note::to<char_T*>(head_begin+pos));
15799 }
15800 _used_size+=str.size();
15801 }else{
15802 _to=_to->do_insert(pos-_used_size,str);
15803 _to_size=_to->get_size();
15804 }
15805 self_changed();
15806 return this;
15807 }
15808 else
15809 return base_t::do_insert(pos,str);
15810 }
15811 protected:
15812 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
15813 if(pos<_used_size){
15814 const char_T* head_begin=_m.end()-_used_size;
15815 const char_T* head_end=_m.end();
15816 const char_T* copy_begin=pos+head_begin;
15817 size_t size_of_copy_from_head=min(size_t(head_end-copy_begin),size);
15818
15819 copy_assign[size_of_copy_from_head](note::from(copy_begin),note::to(to));
15820 if(size!=size_of_copy_from_head){
15821 const size_t size_left=size-size_of_copy_from_head;
15822 char_T* next_copy_begin_pos=to+size_of_copy_from_head;
15823 _to->copy_part_data_to(next_copy_begin_pos,0,size_left);
15824 }
15825 }
15826 else
15827 _to->copy_part_data_to(to,pos-_used_size,size);
15828 }
15829 public:
15830 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
15831 if(index<_used_size){
15832 const char_T* head_begin=_m.end()-_used_size;
15833 return head_begin[index];
15834 }
15835 else
15836 return _to->arec(index-_used_size);
15837 }
15838 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15839 if(this->is_unique()){
15840 if(index<_used_size){
15841 char_T* head_begin=_m.end()-_used_size;
15842 copy_assign(head_begin[index],a);
15843 }
15844 else
15845 _to->arec_set(index-_used_size,a,_to);
15846 self_changed();
15847 }
15848 else
15849 base_t::arec_set(index,a,p);
15850 }
15851 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15852 if(this->is_unique()){
15853 if(_m.size()-_used_size<str.size()){
15854 const auto size_now=this->get_size()+str.size();
15855 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
15856 _m.insert_with_forward_resize(0,str.size(),str.begin(),size_new);
15857 }
15858 else
15859 copy_assign[str.size()](note::from<const char_T*>(str.begin()),note::to<char_T*>(_m.end()-_used_size-str.size()));
15860 _used_size+=str.size();
15861 self_changed();
15862 return this;
15863 }
15864 else
15865 return base_t::apply_str_to_begin(str);
15866 }
15867 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
15868 this->shrink();
15869 return base_t::apply_str_to_begin(str);
15870 }
15871 void shrink()noexcept(_m.forward_resize_nothrow){
15872 _m.forward_resize(_used_size);
15873 }
15874 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15875 if(this->is_unique()){
15876 _to=_to->apply_str_to_end(str);
15877 _to_size+=str.size();
15878 self_changed();
15879 return this;
15880 }
15881 else
15882 return base_t::apply_str_to_end(str);
15883 }
15884 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
15885 if(this->is_unique()){
15886 _to=_to->apply_str_to_end(str);
15887 _to_size+=str->get_size();
15888 self_changed();
15889 return this;
15890 }
15891 else
15892 return base_t::apply_str_to_end(str);
15893 }
15894 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15895 if(this->is_unique() && _used_size>=size){
15896 _used_size-=size;
15897 self_changed();
15898 return get<comn_string_data_t<char_T>>(string_view_t{(char_T*)_m.end()-_used_size-size,size});
15899 }
15900 else
15901 return base_t::do_pop_front(size,self);
15902 }
15903 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15904 if(this->is_unique()){
15905 auto aret=_to->do_pop_back(size,_to);
15906 _to_size-=size;
15907 self_changed();
15908 return aret;
15909 }
15910 else
15911 return base_t::do_pop_back(size,self);
15912 }
15913 protected:
15914 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
15915 suppress_msvc_warning(26494)//未初始化警告diss
15916 hash_t result;
15917 if(_used_size){
15918 const char_T* head_begin=_m.end()-_used_size;
15919 result=hash(head_begin,_used_size);
15920 if(_to_size)
15921 result=hash.merge_array_hash_results(result,_used_size,_to->get_hash(_to),_to_size);
15922 }
15923 else
15924 result=_to->get_hash(_to);
15925 return result;
15926 }
15927 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
15928 if(pos<_used_size){
15929 const char_T* head_begin=_m.end()-_used_size;
15930 const char_T* head_end=_m.end();
15931 const char_T* calculate_begin=pos+head_begin;
15932 const size_t size_of_calculate_from_head=min(size_t(head_end-calculate_begin),size);
15933
15934 before=hash.with_calculated_before(before,before_size,calculate_begin,size_of_calculate_from_head);
15935 if(size!=size_of_calculate_from_head){
15936 const size_t size_left=size-size_of_calculate_from_head;
15937 before_size+=size_of_calculate_from_head;
15938 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,0,size_left);
15939 }
15940 }
15941 else
15942 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos-_used_size,size);
15943 return before;
15944 }
15945 protected:
15946 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
15947 auto wp=down_cast<this_t*>(with.get());
15948 return _used_size==wp->_used_size;// && _to_size==wp->_to_size; //总size被保证一样
15949 }
15950 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
15951 if(begin >= _used_size)
15952 return _to->get_the_largest_complete_data_block_begin_form(begin-_used_size);
15953 else {
15954 const char_T* head_begin = _m.end() - _used_size;
15955 const char_T* head_end = _m.end();
15956 const char_T* ret_begin = begin+head_begin;
15957 return {ret_begin, head_end};
15958 }
15959 }
15960 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15961 auto wp=down_cast<this_t*>(with.get());
15962 const char_T* head_begin = _m.end() - _used_size;
15963 const char_T* wp_head_begin = wp->_m.end() - _used_size;
15964 if(!equal(head_begin,wp_head_begin,_used_size))
15965 return false;
15966 return _to->equal_with(wp->_to);
15967 }
15968 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15969 auto wp=down_cast<this_t*>(with.get());
15970 const char_T* head_begin = _m.end() - _used_size;
15971 const char_T* wp_head_begin = wp->_m.end() - _used_size;
15972 if(auto tmp=compare(head_begin,wp_head_begin,_used_size); tmp!=0)
15973 return tmp;
15974 return _to->compare_with(wp->_to);
15975 }
15976 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15977 return _to->get_memory_cost()+float_size_of(*this)+_m.size_in_byte();
15978 }
15979 };
15980 template<typename char_T>
15981 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow){
15982 if(str.size())
15983 return get<head_apply_string_data_t<char_T>>(this,str);
15984 else
15985 return this;
15986 }
15987
15988 //file_end
15989
15990 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15991 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/end_apply_string_data_t.hpp"
15992 //end_apply_string_data_t.hpp
15993 //at namespace elc::defs::string_n::string_data_n
15994 /*
15995 未完成的elc解释器string文件
15996 由steve02081504与Alex0125设计、编写
15997 转载时请在不对此文件做任何修改的同时注明出处
15998 项目地址:https://github.com/steve02081504/ELC
15999 */
16000 template<typename char_T>
16001 struct end_apply_string_data_t final:base_string_data_t<char_T>,instance_struct<end_apply_string_data_t<char_T>>{
16004 using base_t::ptr_t;
16006 using base_t::self_changed;
16007
16008 using base_t::copy_assign_nothrow;
16009 using base_t::copy_construct_nothrow;
16010 using base_t::move_construct_nothrow;
16011 using base_t::construct_nothrow;
16012 using base_t::destruct_nothrow;
16013 using base_t::clear_nothrow;
16014 using base_t::ptr_reset_nothrow;
16015 using base_t::hash_nothrow;
16016 using base_t::get_data_nothrow;
16017 using base_t::apply_data_nothrow;
16018 using base_t::set_hash_cache;
16019
16020 array_t<char_T> _m;
16022 size_t _to_size;
16024
16025 end_apply_string_data_t(ptr_t str,string_view_t end)noexcept(construct_nothrow&&copy_assign_nothrow):
16026 _to_size(str->get_size()),
16027 _used_size(end.size()),
16028 _to(str)
16029 {
16030 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
16031 copy_assign[_used_size](note::from(end.begin()),note::to((char_T*)_m));
16032 }
16033 end_apply_string_data_t(ptr_t str,size_t count,char_T ch)noexcept:
16034 _to_size(str->get_size()),
16035 _used_size(count),
16036 _to(str)
16037 {
16038 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
16039 copy_assign[_used_size](ch,note::to((char_T*)_m));
16040 }
16041 end_apply_string_data_t(ptr_t str,size_t count)noexcept:
16042 _to_size(str->get_size()),
16043 _used_size(count),
16044 _to(str)
16045 {
16046 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
16047 }
16048
16049 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16050 if(begin+size<=_to_size)
16051 return _to->get_substr_data(begin,size);
16052 else
16053 return base_t::get_substr_data(begin,size);
16054 }
16055 [[nodiscard]]virtual char_T* get_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
16056 if(!_used_size)
16057 return _to->get_c_str(_to);
16058 else
16059 return base_t::get_c_str(p);
16060 }
16061 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
16062 if(type_info<this_t> == typeid(*a)){
16063 const auto p = down_cast<this_t*>(a.get());
16064 if(_used_size==p->_used_size && _to!=p->_to)
16065 base_t::equivalent_optimization(_to, p->_to);
16066 }
16067 _m.clear();
16068 _to.reset();
16069 base_t::be_replace_as(a);
16070 }
16071 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _used_size+_to_size; }
16072 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow)override final{
16073 if(pos==0)
16074 return this->apply_str_to_begin(str);
16075 elseif(pos==get_size())
16076 return this->apply_str_to_end(str);
16077 elseif(this->is_unique()){
16078 if(pos<_to_size){
16079 _to=_to->do_insert(pos-_used_size,str);
16080 _to_size=_to->get_size();
16081 }
16082 else{
16083 pos-=_to_size;
16084 if(_m.size()-_used_size<str.size()){
16085 const auto size_now=this->get_size()+str.size();
16086 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
16087 _m.insert_with_resize(pos,str.size(),str.begin(),size_new);
16088 }
16089 else{
16090 copy_assign[_used_size-pos](note::from<const char_T*>(&_m[pos]),note::to((char_T*)&_m[pos+str.size()]));
16091 copy_assign[str.size()](note::from<const char_T*>(str.begin()),note::to<char_T*>(&_m[pos]));
16092 }
16093 _used_size+=str.size();
16094 }
16095 self_changed();
16096 return this;
16097 }
16098 else
16099 return base_t::do_insert(pos,str);
16100 }
16101 protected:
16102 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16103 if(pos+size<=_to_size)
16104 _to->copy_part_data_to(to,pos,size);
16105 else{
16106 if(pos<_to_size){
16107 _to->copy_part_data_to(to,pos,_to_size-pos);
16108 auto copied_size=_to_size-pos;
16109 pos=0;
16110 size-=copied_size;
16111 to+=copied_size;
16112 }
16113 else
16114 pos-=_to_size;
16115 copy_assign[size](note::from((const char_T*)_m+pos),note::to(to));
16116 }
16117 }
16118 public:
16119 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16120 if(index<_to_size)
16121 return _to->arec(index);
16122 else
16123 return _m[index-_to_size];
16124 }
16125 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16126 if(this->is_unique()){
16127 if(index<_to_size)
16128 _to->arec_set(index,a,_to);
16129 else
16130 copy_assign(_m[index - _to_size],a);
16131 self_changed();
16132 }
16133 else
16134 base_t::arec_set(index,a,p);
16135 }
16136
16137 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16138 if(this->is_unique()){
16139 if(_m.size()-_used_size < str.size()){
16140 const auto size_now=this->get_size()+str.size();
16141 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
16142 _m.insert_with_resize(_used_size,str.size(),str.begin(),size_new);
16143 }
16144 else
16145 copy_assign[str.size()](note::from(str.begin()),note::to((char_T*)_m+_used_size));
16146 _used_size+=str.size();
16147 self_changed();
16148 return this;
16149 }
16150 else
16151 return base_t::apply_str_to_end(str);
16152 }
16153 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16154 this->shrink();
16155 return base_t::apply_str_to_end(str);
16156 }
16157 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16158 if(this->is_unique()){
16159 _to=_to->apply_str_to_begin(str);
16160 _to_size+=str.size();
16161 self_changed();
16162 return this;
16163 }
16164 else
16165 return base_t::apply_str_to_begin(str);
16166 }
16167 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16168 if(this->is_unique()){
16169 _to=_to->apply_str_to_begin(str);
16170 _to_size+=str->get_size();
16171 self_changed();
16172 return this;
16173 }
16174 else
16175 return base_t::apply_str_to_begin(str);
16176 }
16177 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16178 if(this->is_unique()){
16179 auto aret=_to->do_pop_front(size,_to);
16180 _to_size-=size;
16181 self_changed();
16182 return aret;
16183 }
16184 else
16185 return base_t::do_pop_front(size,self);
16186 }
16187 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16188 if(this->is_unique() && _used_size>=size){
16189 _used_size-=size;
16190 self_changed();
16191 return get<comn_string_data_t<char_T>>(string_view_t{(char_T*)_m+_used_size,size});
16192 }
16193 else
16194 return base_t::do_pop_back(size,self);
16195 }
16196 protected:
16197 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16198 return hash.with_calculated_before(_to->get_hash(_to),_to_size,string_view_t(_m.begin(),_used_size));
16199 }
16200 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
16201 if(pos+size<=_to_size)
16202 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size);
16203 else{
16204 if(pos<_to_size){
16205 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,_to_size-pos);
16206 const auto calculated_size=_to_size-pos;
16207 pos=0;
16208 size-=calculated_size;
16209 before_size+=calculated_size;
16210 }
16211 else
16212 pos-=_to_size;
16213 before=hash.with_calculated_before(before,before_size,(const char_T*)_m+pos,size);
16214 }
16215 return before;
16216 }
16217 void shrink()noexcept(_m.resize_nothrow){
16218 _m.resize(_used_size);
16219 }
16220 protected:
16221 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
16222 auto wp = down_cast<this_t*>(with.get());
16223 return _used_size==wp->_used_size;// && _to_size==wp->_to_size; //总size被保证一样
16224 }
16225 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
16226 if(begin < _to_size){
16227 return _to->get_the_largest_complete_data_block_begin_form(begin);
16228 }
16229 else {
16230 begin-=_to_size;
16231 return {_m.begin()+begin,note::size(_used_size-begin)};
16232 }
16233 }
16234 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
16235 auto wp=down_cast<this_t*>(with.get());
16236 if(!_to->equal_with(wp->_to))
16237 return false;
16238 return equal((char_T*)_m.begin(),(char_T*)wp->_m.begin(),_used_size);
16239 }
16240 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
16241 auto wp=down_cast<this_t*>(with.get());
16242 if(auto tmp=_to->compare_with(wp->_to); tmp!=0)
16243 return tmp;
16244 return compare((char_T*)_m.begin(),(char_T*)wp->_m.begin(),_used_size);
16245 }
16246 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
16247 return _to->get_memory_cost()+float_size_of(*this)+_m.size_in_byte();
16248 }
16249 };
16250 template<typename char_T>
16251 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow){
16252 if(str.size())
16253 return get<end_apply_string_data_t<char_T>>(this,str);
16254 else
16255 return this;
16256 }
16257
16258 //file_end
16259
16260 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
16261
16262 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/sum_string_data_t.hpp"
16263 //sum_string_data_t.hpp
16264 //at namespace elc::defs::string_n::string_data_n
16265 /*
16266 未完成的elc解释器string文件
16267 由steve02081504与Alex0125设计、编写
16268 转载时请在不对此文件做任何修改的同时注明出处
16269 项目地址:https://github.com/steve02081504/ELC
16270 */
16271 template<typename char_T>
16272 struct sum_string_data_t final:base_string_data_t<char_T>,instance_struct<sum_string_data_t<char_T>>{
16275 using base_t::ptr_t;
16277 using base_t::self_changed;
16278
16279 using base_t::copy_assign_nothrow;
16280 using base_t::copy_construct_nothrow;
16281 using base_t::move_construct_nothrow;
16282 using base_t::construct_nothrow;
16283 using base_t::destruct_nothrow;
16284 using base_t::clear_nothrow;
16285 using base_t::ptr_reset_nothrow;
16286 using base_t::hash_nothrow;
16287 using base_t::get_data_nothrow;
16288 using base_t::apply_data_nothrow;
16289 using base_t::set_hash_cache;
16290
16295
16296 sum_string_data_t(ptr_t before,ptr_t after)noexcept:_before(before),_after(after),_before_size(_before->get_size()),_after_size(_after->get_size()){
16297 if(!_before_size)
16298 be_replace_as(_after);
16299 elseif(!_after_size)
16300 be_replace_as(_before);
16301 }
16302
16303 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16304 if(begin+size<=_before_size)
16305 return _before->get_substr_data(begin,size);
16306 elseif(begin>=_before_size)
16307 return _after->get_substr_data(begin-_before_size,size);
16308 else
16309 return base_t::get_substr_data(begin,size);
16310 }
16311 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
16312 if(type_info<this_t> == typeid(*a)){
16313 const auto p = down_cast<this_t*>(a.get());
16314 if(_before_size==p->_before_size){
16315 if(_before!=p->_before)
16316 base_t::equivalent_optimization(_before, p->_before);
16317 if(_after!=p->_after)
16318 base_t::equivalent_optimization(_after, p->_after);
16319 }
16320 }
16321 _before.reset();
16322 _after.reset();
16323 base_t::be_replace_as(a);
16324 }
16325 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _before_size+_after_size; }
16326 protected:
16327 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16328 if(pos<_before_size){
16329 const auto copy_before_begin=pos;
16330 const auto copy_before_end=min(pos+size,_before_size);
16331 const auto copy_before_size=copy_before_end-copy_before_begin;
16332 _before->copy_part_data_to(to,copy_before_begin,copy_before_size);
16333 if(size!=copy_before_size){
16334 const auto copy_after_size=size-copy_before_size;
16335 to+=copy_before_size;
16336 _after->copy_part_data_to(to,0,copy_after_size);
16337 }
16338 }
16339 else
16340 _after->copy_part_data_to(to,pos-_before_size,size);
16341 }
16342 public:
16343 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16344 if(index<_before_size)
16345 return _before->arec(index);
16346 else
16347 return _after->arec(index-_before_size);
16348 }
16349 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16350 if(this->is_unique()){
16351 if(index<_before_size)
16352 _before->arec_set(index,a,_before);
16353 else
16354 _after->arec_set(index-_before_size,a,_after);
16355 self_changed();
16356 }
16357 else
16358 base_t::arec_set(index,a,p);
16359 }
16360 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16361 if(this->is_unique()){
16362 _before=_before->apply_str_to_begin(str);
16363 _before_size+=str.size();
16364 self_changed();
16365 return this;
16366 }
16367 else
16368 return base_t::apply_str_to_begin(str);
16369 }
16370 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16371 if(this->is_unique()){
16372 _before=_before->apply_str_to_begin(str);
16373 _before_size+=str->get_size();
16374 self_changed();
16375 return this;
16376 }
16377 else
16378 return base_t::apply_str_to_begin(str);
16379 }
16380 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16381 if(this->is_unique()){
16382 _after=_after->apply_str_to_end(str);
16383 _after_size+=str.size();
16384 self_changed();
16385 return this;
16386 }
16387 else
16388 return base_t::apply_str_to_end(str);
16389 }
16390 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16391 if(this->is_unique()){
16392 _after=_after->apply_str_to_end(str);
16393 _after_size+=str->get_size();
16394 self_changed();
16395 return this;
16396 }
16397 else
16398 return base_t::apply_str_to_end(str);
16399 }
16400 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16401 if(this->is_unique() && _before_size>=size){
16402 ptr_t aret;
16403 if(_before_size==size)
16404 swap(aret,_before);
16405 else
16406 aret=_before->do_pop_front(size,_before);
16407 _before_size-=size;
16408 if(!_before_size)
16409 be_replace_as(_after);
16410 self_changed();
16411 return aret;
16412 }
16413 else
16414 return base_t::do_pop_front(size,self);
16415 }
16416 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16417 if(this->is_unique() && _after_size>=size){
16418 ptr_t aret;
16419 if(_before_size==size)
16420 swap(aret,_after);
16421 else
16422 aret=_after->do_pop_back(size,_after);
16423 _after_size-=size;
16424 if(!_after_size)
16425 be_replace_as(_before);
16426 self_changed();
16427 return aret;
16428 }
16429 else
16430 return base_t::do_pop_back(size,self);
16431 }
16432 protected:
16433 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16434 suppress_msvc_warning(26494)//未初始化警告diss
16435 hash_t result;
16436 if(_before_size){
16437 result=_before->get_hash(_before);
16438 if(_after_size)
16439 result=hash.merge_array_hash_results(result,_before_size,_after->get_hash(_after),_after_size);
16440 }
16441 else
16442 result=_after->get_hash(_after);
16443 return result;
16444 }
16445 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
16446 if(pos<_before_size){
16447 const auto calculate_before_begin=pos;
16448 const auto calculate_before_end=min(pos+size,_before_size);
16449 const auto calculate_before_size=calculate_before_end-calculate_before_begin;
16450 before=_before->get_others_hash_with_calculated_before(before,before_size,_before,calculate_before_begin,calculate_before_size);
16451 if(size!=calculate_before_size){
16452 const auto calculate_after_size=size-calculate_before_size;
16453 before_size+=calculate_before_size;
16454 before=_after->get_others_hash_with_calculated_before(before,before_size,_after,0,calculate_after_size);
16455 }
16456 }
16457 else
16458 before=_after->get_others_hash_with_calculated_before(before,before_size,_after,pos-_before_size,size);
16459 return before;
16460 }
16461 protected:
16462 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
16463 auto wp=down_cast<this_t*>(with.get());
16464 return _before_size==wp->_before_size;//总size被保证一样
16465 }
16466 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
16467 if(begin < _before_size)
16468 return _before->get_the_largest_complete_data_block_begin_form(begin);
16469 else
16470 return _after->get_the_largest_complete_data_block_begin_form(begin - _before_size);
16471 }
16472 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
16473 auto wp=down_cast<this_t*>(with.get());
16474 if(!this->_before->equal_with(wp->_before))
16475 return false;
16476 return this->_after->equal_with(wp->_after);
16477 }
16478 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
16479 auto wp=down_cast<this_t*>(with.get());
16480 if(auto tmp=this->_before->compare_with(wp->_before); tmp!=0)
16481 return tmp;
16482 return this->_after->compare_with(wp->_after);
16483 }
16484 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
16485 return float_size_of(*this)+_before->get_memory_cost()+_after->get_memory_cost();
16486 }
16487 };
16488 template<typename char_T>
16490 return get<sum_string_data_t<char_T>>(this,str);
16491 }
16492 template<typename char_T>
16494 return get<sum_string_data_t<char_T>>(str,this);
16495 }
16496
16497 //file_end
16498
16499 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
16500
16501 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/erased_string_data_t.hpp"
16502 //erased_string_data_t.hpp
16503 //at namespace elc::defs::string_n::string_data_n
16504 /*
16505 未完成的elc解释器string文件
16506 由steve02081504与Alex0125设计、编写
16507 转载时请在不对此文件做任何修改的同时注明出处
16508 项目地址:https://github.com/steve02081504/ELC
16509 */
16510 template<typename char_T>
16511 struct erased_string_data_t final:base_string_data_t<char_T>,instance_struct<erased_string_data_t<char_T>>{
16514 using base_t::ptr_t;
16516 using base_t::self_changed;
16517
16518 using base_t::copy_assign_nothrow;
16519 using base_t::copy_construct_nothrow;
16520 using base_t::move_construct_nothrow;
16521 using base_t::construct_nothrow;
16522 using base_t::destruct_nothrow;
16523 using base_t::clear_nothrow;
16524 using base_t::ptr_reset_nothrow;
16525 using base_t::hash_nothrow;
16526 using base_t::get_data_nothrow;
16527 using base_t::apply_data_nothrow;
16528 using base_t::set_hash_cache;
16529
16531 size_t _to_size;
16534
16536 if(_to_size==_erase_size || !_to_size)
16537 be_replace_as(null_ptr);
16538 }
16539
16540 erased_string_data_t(ptr_t str,size_t erase_pos,size_t erase_size)noexcept:_to(str),_to_size(_to->get_size()),_erase_pos(erase_pos),_erase_size(erase_size){
16541 null_equivalent_check();
16542 }
16543
16544 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16545 if(begin+size<_erase_pos)
16546 return _to->get_substr_data(begin,size);
16547 elseif(begin>_erase_pos)
16548 return _to->get_substr_data(begin+_erase_size,size);
16549 else
16550 return base_t::get_substr_data(begin,size);
16551 }
16552 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final {
16553 if(type_info<this_t> == typeid(*a)){
16554 const auto p = down_cast<this_t*>(a.get());
16555 if(_erase_pos==p->_erase_pos && _erase_size==p->_erase_size && _to!=p->_to)
16556 base_t::equivalent_optimization(_to, p->_to);
16557 }
16558 _to.reset();
16559 base_t::be_replace_as(a);
16560 }
16561 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _to_size-_erase_size; }
16562 protected:
16563 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16564 if(pos+size<_erase_pos)
16565 _to->copy_part_data_to(to,pos,size);
16566 elseif(pos>_erase_pos)
16567 _to->copy_part_data_to(to,pos+_erase_size,size);
16568 else{
16569 const auto size_before_erase_pos=_erase_pos-pos;
16570 const auto size_after_erase_pos=size-size_before_erase_pos;
16571 _to->copy_part_data_to(to,pos,size_before_erase_pos);
16572 _to->copy_part_data_to(to+size_before_erase_pos,_erase_pos+_erase_size,size_after_erase_pos);
16573 }
16574 }
16575 public:
16576 [[nodiscard]]virtual ptr_t do_erase(size_t pos,size_t size)noexcept override final{
16577 if(this->is_unique()){
16578 if(pos<=_erase_pos && pos+size>=_erase_pos+_erase_size){
16579 _erase_pos=pos;
16580 _erase_size+=size;
16581 self_changed();
16582 return this;
16583 }
16584 }
16585 return base_t::do_erase(pos,size);
16586 }
16587 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16588 if(index>_erase_pos)
16589 return _to->arec(index+_erase_size);
16590 else
16591 return _to->arec(index);
16592 }
16593
16594 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16595 if(this->is_unique()){
16596 if(index>_erase_pos)
16597 _to->arec_set(index+_erase_size,a,_to);
16598 else
16599 _to->arec_set(index,a,_to);
16600 self_changed();
16601 }
16602 else
16603 base_t::arec_set(index,a,p);
16604 }
16605 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16606 if(this->is_unique()){
16607 _to=_to->apply_str_to_begin(str);
16608 const auto strsize=str.size();
16609 _to_size+=strsize;
16610 _erase_pos+=strsize;
16611 self_changed();
16612 return this;
16613 }
16614 else
16615 return base_t::apply_str_to_begin(str);
16616 }
16617 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16618 if(this->is_unique()){
16619 _to=_to->apply_str_to_begin(str);
16620 const auto strsize=str->get_size();
16621 _to_size+=strsize;
16622 _erase_pos+=strsize;
16623 self_changed();
16624 return this;
16625 }
16626 else
16627 return base_t::apply_str_to_begin(str);
16628 }
16629 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16630 if(this->is_unique()){
16631 _to=_to->apply_str_to_end(str);
16632 _to_size+=str.size();
16633 self_changed();
16634 return this;
16635 }
16636 else
16637 return base_t::apply_str_to_end(str);
16638 }
16639 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16640 if(this->is_unique()){
16641 _to=_to->apply_str_to_end(str);
16642 _to_size+=str->get_size();
16643 self_changed();
16644 return this;
16645 }
16646 else
16647 return base_t::apply_str_to_end(str);
16648 }
16649 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16650 if(this->is_unique() && _erase_pos > size){
16651 auto aret=_to->do_pop_front(size,_to);
16652 _to_size-=size;
16653 _erase_pos-=size;
16654 null_equivalent_check();
16655 self_changed();
16656 return aret;
16657 }
16658 else
16659 return base_t::do_pop_front(size,self);
16660 }
16661 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16662 if(this->is_unique() && _erase_pos+_erase_size <= _to_size-size){
16663 auto aret=_to->do_pop_back(size,_to);
16664 _to_size-=size;
16665 null_equivalent_check();
16666 self_changed();
16667 return aret;
16668 }
16669 else
16670 return base_t::do_pop_back(size,self);
16671 }
16672 protected:
16673 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16674 auto result=hash(nothing);
16675 const auto size=get_size();
16676 const auto size_before_erase_pos=_erase_pos;
16677 const auto size_after_erase_pos=size-size_before_erase_pos;
16678 result=_to->get_others_hash_with_calculated_before(result,0,_to,0,size_before_erase_pos);
16679 result=_to->get_others_hash_with_calculated_before(result,size_before_erase_pos,_to,_erase_pos+_erase_size,size_after_erase_pos);
16680 return result;
16681 }
16682 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
16683 if(pos+size<_erase_pos)
16684 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size);
16685 elseif(pos>_erase_pos)
16686 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos+_erase_size,size);
16687 else{
16688 const auto size_before_erase_pos=_erase_pos-pos;
16689 const auto size_after_erase_pos=size-size_before_erase_pos;
16690 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size_before_erase_pos);
16691 before=_to->get_others_hash_with_calculated_before(before,before_size+size_before_erase_pos,_to,_erase_pos+_erase_size,size_after_erase_pos);
16692 }
16693 return before;
16694 }
16695 protected:
16696 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
16697 auto wp = down_cast<this_t*>(with.get());
16698 return _erase_pos == wp->_erase_pos && _erase_size == wp->_erase_size;
16699 }
16700 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
16701 if(begin < _erase_pos){
16702 auto aret=_to->get_the_largest_complete_data_block_begin_form(begin);
16703 if(aret.size() > _erase_pos){
16704 aret = {aret.begin(),_erase_pos};
16705 }
16706 return aret;
16707 }
16708 else
16709 return _to->get_the_largest_complete_data_block_begin_form(begin + _erase_size);
16710 }
16711 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
16712 auto wp=down_cast<this_t*>(with.get());
16713 if(!_to->equal_with(wp->_to,0,_erase_pos))
16714 return false;
16715 return _to->equal_with(wp->_to,_erase_pos+_erase_size,_to_size);
16716 }
16717 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
16718 auto wp=down_cast<this_t*>(with.get());
16719 if(auto tmp=_to->compare_with(wp->_to,0,_erase_pos); tmp!=0)
16720 return tmp;
16721 return _to->compare_with(wp->_to,_erase_pos+_erase_size,_to_size);
16722 }
16723 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
16724 return float_size_of(*this)+_to->get_memory_cost();
16725 }
16726 };
16727 template<typename char_T>
16729 if(size==get_size())
16730 return null_ptr;
16731 else
16732 return get<erased_string_data_t<char_T>>(this,pos,size);
16733 }
16734
16735 //file_end
16736
16737 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
16738 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/inserted_string_data_t.hpp"
16739 //inserted_string_data_t.hpp
16740 //at namespace elc::defs::string_n::string_data_n
16741 /*
16742 未完成的elc解释器string文件
16743 由steve02081504与Alex0125设计、编写
16744 转载时请在不对此文件做任何修改的同时注明出处
16745 项目地址:https://github.com/steve02081504/ELC
16746 */
16747 template<typename char_T>
16748 struct inserted_string_data_t final: base_string_data_t<char_T>,instance_struct<inserted_string_data_t<char_T>>{
16751 using base_t::ptr_t;
16753 using base_t::self_changed;
16754
16755 using base_t::copy_assign_nothrow;
16756 using base_t::copy_construct_nothrow;
16757 using base_t::move_construct_nothrow;
16758 using base_t::construct_nothrow;
16759 using base_t::destruct_nothrow;
16760 using base_t::clear_nothrow;
16761 using base_t::ptr_reset_nothrow;
16762 using base_t::hash_nothrow;
16763 using base_t::get_data_nothrow;
16764 using base_t::apply_data_nothrow;
16765 using base_t::set_hash_cache;
16766
16769 size_t _to_size;
16772
16773 inserted_string_data_t(ptr_t to,ptr_t insert_data,size_t insert_pos)noexcept:_to(to),_insert_data(insert_data),_insert_pos(insert_pos),_to_size(to->get_size()),_insert_size(insert_data->get_size()){}
16774
16775 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16776 if(begin+size<_insert_pos)
16777 return _to->get_substr_data(begin,size);
16778 elseif(begin>_insert_pos+_insert_size)
16779 return _to->get_substr_data(begin-_insert_size,size);
16780 elseif(begin>=_insert_pos && begin+size<=_insert_pos+_insert_size)
16781 return _insert_data->get_substr_data(begin-_insert_pos,size);
16782 else
16783 return base_t::get_substr_data(begin,size);
16784 }
16785 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
16786 if(type_info<this_t> == typeid(*a)){
16787 const auto p = down_cast<this_t*>(a.get());
16788 if(_insert_pos==p->_insert_pos && _insert_size==p->_insert_size){
16789 if(_to!=p->_to)
16790 base_t::equivalent_optimization(_to, p->_to);
16791 if(_insert_data!=p->_insert_data)
16792 base_t::equivalent_optimization(_insert_data, p->_insert_data);
16793 }
16794 }
16795 _to.reset();
16796 _insert_data.reset();
16797 base_t::be_replace_as(a);
16798 }
16799 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _to_size+_insert_size; }
16800 protected:
16801 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16802 if(pos+size<_insert_pos)
16803 _to->copy_part_data_to(to,pos,size);
16804 elseif(pos>_insert_pos+_insert_size)
16805 _to->copy_part_data_to(to,pos-_insert_size,size);
16806 else{
16807 if(_insert_pos>pos){
16808 auto size_before_insert_pos=_insert_pos-pos;
16809 _to->copy_part_data_to(to,pos,size_before_insert_pos);
16810 to+=size_before_insert_pos;
16811 size-=size_before_insert_pos;
16812 }
16813 auto size_before_insert_end=min(size,_insert_size);
16814 _insert_data->copy_part_data_to(to,0,size_before_insert_end);
16815 to+=size_before_insert_end;
16816 size-=size_before_insert_end;
16817 if(size)
16818 _to->copy_part_data_to(to,_insert_pos,size);
16819 }
16820 }
16821 public:
16822 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow)override final{
16823 if(this->is_unique()){
16824 if(pos>=_insert_pos && pos<=_insert_pos+_insert_size){
16825 _insert_data=_insert_data->do_insert(pos-_insert_pos,str);
16826 _insert_size+=str.size();
16827 }
16828 elseif(pos<_insert_pos){
16829 _to=_to->do_insert(pos,str);
16830 _to_size+=str.size();
16831 _insert_pos+=str.size();
16832 }
16833 elseif(pos>_insert_pos+_insert_size){
16834 _to=_to->do_insert(pos-_insert_size,str);
16835 _to_size+=str.size();
16836 }
16837 self_changed();
16838 return this;
16839 }
16840 return base_t::do_insert(pos,str);
16841 }
16842 [[nodiscard]]virtual ptr_t do_erase(size_t pos,size_t size)noexcept override final{
16843 if(this->is_unique()){
16844 if(pos>=_insert_pos && pos+size<=_insert_pos+_insert_size){
16845 _insert_data=_insert_data->do_erase(pos-_insert_pos,size);
16846 _insert_size-=size;
16847 self_changed();
16848 return this;
16849 }
16850 elseif(pos+size<_insert_pos){
16851 _to=_to->do_erase(pos,size);
16852 _to_size-=size;
16853 _insert_pos-=size;
16854 self_changed();
16855 return this;
16856 }
16857 elseif(pos>_insert_pos+_insert_size){
16858 _to=_to->do_erase(pos-_insert_size,size);
16859 _to_size-=size;
16860 self_changed();
16861 return this;
16862 }
16863 }
16864 return base_t::do_erase(pos,size);
16865 }
16866 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16867 if(index>=_insert_pos && index<_insert_pos+_insert_size)
16868 return _insert_data->arec(index-_insert_pos);
16869 elseif(index>=_insert_pos+_insert_size)
16870 return _to->arec(index-_insert_size);
16871 else
16872 return _to->arec(index);
16873 }
16874
16875 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16876 if(this->is_unique()){
16877 if(index>=_insert_pos && index<_insert_pos+_insert_size)
16878 _insert_data->arec_set(index-_insert_pos,a,p);
16879 elseif(index>=_insert_pos+_insert_size)
16880 _to->arec_set(index-_insert_size,a,p);
16881 else
16882 _to->arec_set(index,a,p);
16883 self_changed();
16884 }
16885 else
16886 base_t::arec_set(index,a,p);
16887 }
16888 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16889 if(this->is_unique()){
16890 const auto size=str.size();
16891 if(_insert_pos==0){
16892 _insert_data=_insert_data->apply_str_to_begin(str);
16893 _insert_size+=size;
16894 }
16895 else{
16896 _to=_to->apply_str_to_begin(str);
16897 _to_size+=str.size();
16898 _insert_pos+=size;
16899 }
16900 self_changed();
16901 return this;
16902 }
16903 else
16904 return base_t::apply_str_to_begin(str);
16905 }
16906 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16907 if(this->is_unique()){
16908 const auto size=str->get_size();
16909 if(_insert_pos==0){
16910 _insert_data=_insert_data->apply_str_to_begin(str);
16911 _insert_size+=size;
16912 }
16913 else{
16914 _to=_to->apply_str_to_begin(str);
16915 _to_size+=str->get_size();
16916 _insert_pos+=size;
16917 }
16918 self_changed();
16919 return this;
16920 }
16921 else
16922 return base_t::apply_str_to_begin(str);
16923 }
16924 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16925 if(this->is_unique()){
16926 if(_insert_pos==_to_size){
16927 _insert_data=_insert_data->apply_str_to_end(str);
16928 _insert_size+=str.size();
16929 }
16930 else{
16931 _to=_to->apply_str_to_end(str);
16932 _to_size+=str.size();
16933 }
16934 self_changed();
16935 return this;
16936 }
16937 else
16938 return base_t::apply_str_to_end(str);
16939 }
16940 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16941 if(this->is_unique()){
16942 if(_insert_pos==_to_size){
16943 _insert_data=_insert_data->apply_str_to_end(str);
16944 _insert_size+=str->get_size();
16945 }
16946 else{
16947 _to=_to->apply_str_to_end(str);
16948 _to_size+=str->get_size();
16949 }
16950 self_changed();
16951 return this;
16952 }
16953 else
16954 return base_t::apply_str_to_end(str);
16955 }
16956 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16957 if(this->is_unique()){
16958 if(_insert_pos > size){
16959 auto aret=_to->do_pop_front(size,_to);
16960 _to_size-=size;
16961 _insert_pos-=size;
16962 self_changed();
16963 return aret;
16964 }
16965 elseif(_insert_pos==0 && _insert_size>=size){
16966 auto aret=_insert_data->do_pop_front(size,_insert_data);
16967 _insert_size-=size;
16968 self_changed();
16969 return aret;
16970 }
16971 }
16972 return base_t::do_pop_front(size,self);
16973 }
16974 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16975 if(this->is_unique()){
16976 if(_insert_pos+_insert_size <= _to_size-size){
16977 auto aret=_to->do_pop_back(size,_to);
16978 _to_size-=size;
16979 self_changed();
16980 return aret;
16981 }
16982 elseif(_insert_pos==_to_size && _insert_size>=size){
16983 auto aret=_insert_data->do_pop_front(size,_insert_data);
16984 _insert_size-=size;
16985 self_changed();
16986 return aret;
16987 }
16988 }
16989 return base_t::do_pop_back(size,self);
16990 }
16991 protected:
16992 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16993 auto result=hash(nothing);
16994 if(_insert_pos){
16995 result=_to->get_others_hash_with_calculated_before(result,0,_to,0,_insert_pos);
16996 }
16997 result=hash.merge_array_hash_results(result,_insert_pos,_insert_data->get_hash(_insert_data),_insert_size);
16998 const auto size=_to_size-_insert_pos;
16999 if(size)
17000 result=_to->get_others_hash_with_calculated_before(result,_insert_pos+_insert_size,_to,_insert_pos,size);
17001 return result;
17002 }
17003 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
17004 if(pos+size<_insert_pos)
17005 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size);
17006 elseif(pos>_insert_pos+_insert_size)
17007 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos-_insert_size,size);
17008 else{
17009 if(_insert_pos>pos){
17010 const auto size_before_insert_pos=_insert_pos-pos;
17011 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size_before_insert_pos);
17012 size-=size_before_insert_pos;
17013 before_size+=size_before_insert_pos;
17014 }
17015 auto size_before_insert_end=min(size,_insert_size);
17016 before=_insert_data->get_others_hash_with_calculated_before(before,before_size,_insert_data,0,size_before_insert_end);
17017 size-=size_before_insert_end;
17018 before_size+=size_before_insert_end;
17019 if(size)
17020 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,_insert_pos,size);
17021 }
17022 return before;
17023 }
17024 protected:
17025 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
17026 auto wp=down_cast<this_t*>(with.get());
17027 return _insert_pos==wp->_insert_pos && _insert_size==wp->_insert_size;//总size被保证一样
17028 }
17029 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t index)noexcept override final{
17030 if(index>=_insert_pos && index<_insert_pos+_insert_size)
17031 return _insert_data->get_the_largest_complete_data_block_begin_form(index-_insert_pos);
17032 elseif(index>=_insert_pos+_insert_size)
17033 return _to->get_the_largest_complete_data_block_begin_form(index-_insert_size);
17034 else {
17035 auto aret=_to->get_the_largest_complete_data_block_begin_form(index);
17036 if(aret.size()+index > _insert_pos)
17037 aret = {aret.begin(), note::size(_insert_pos-index)};
17038 return aret;
17039 }
17040 }
17041 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
17042 auto wp=down_cast<this_t*>(with.get());
17043 if(!_insert_data->equal_with(wp->_insert_data))
17044 return false;
17045 return _to->equal_with(wp->_to);
17046 }
17047 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
17048 auto wp=down_cast<this_t*>(with.get());
17049 if(auto tmp=_to->compare_with(wp->_to,0,_insert_pos); tmp!=0)
17050 return tmp;
17051 if(auto tmp=_insert_data->compare_with(wp->_insert_data); tmp!=0)
17052 return tmp;
17053 return _to->compare_with(wp->_to,_insert_pos,_to_size-(_insert_pos+_insert_size));
17054 }
17055 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
17056 return float_size_of(*this)+_insert_data->get_memory_cost()+_to->get_memory_cost();
17057 }
17058 };
17059 template<typename char_T>
17061 return get<inserted_string_data_t<char_T>>(this,str,pos);
17062 }
17063 template<typename char_T>
17065 if(pos==0)
17066 return this->apply_str_to_begin(str);
17067 elseif(pos==get_size())
17068 return this->apply_str_to_end(str);
17069 else
17070 return this->do_insert(pos,get<comn_string_data_t<char_T>>(str));
17071 }
17072
17073 //file_end
17074
17075 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
17076
17077 //#include "replaced_string_data_t.hpp"
17078
17079 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/same_value_compress_string_data_t.hpp"
17080 //sum_string_data_t.hpp
17081 //at namespace elc::defs::string_n::string_data_n
17082 /*
17083 未完成的elc解释器string文件
17084 由steve02081504与Alex0125设计、编写
17085 转载时请在不对此文件做任何修改的同时注明出处
17086 项目地址:https://github.com/steve02081504/ELC
17087 */
17088 template<typename char_T>
17089 struct same_value_compress_string_data_t final:base_string_data_t<char_T>,instance_struct<same_value_compress_string_data_t<char_T>>{
17092 using base_t::ptr_t;
17094 using base_t::self_changed;
17095
17096 using base_t::copy_assign_nothrow;
17097 using base_t::copy_construct_nothrow;
17098 using base_t::move_construct_nothrow;
17099 using base_t::construct_nothrow;
17100 using base_t::destruct_nothrow;
17101 using base_t::clear_nothrow;
17102 using base_t::ptr_reset_nothrow;
17103 using base_t::hash_nothrow;
17104 using base_t::get_data_nothrow;
17105 using base_t::apply_data_nothrow;
17106 using base_t::set_hash_cache;
17107
17108 size_t _size;
17109 char_T _value;
17110
17111 same_value_compress_string_data_t(size_t size,char_T value)noexcept:_size(size),_value(value){}
17112
17113 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
17114 base_t::be_replace_as(a);
17115 }
17116 [[nodiscard]]virtual ptr_t get_substr_data([[maybe_unused]]size_t begin,size_t size)noexcept override final{
17117 return get<same_value_compress_string_data_t<char_T>>(size,_value);
17118 }
17119 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _size; }
17120 protected:
17121 virtual void copy_part_data_to(char_T* to,[[maybe_unused]]size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
17122 copy_assign[size](_value,note::to(to));
17123 }
17124 public:
17125 [[nodiscard]]virtual char_T arec([[maybe_unused]]size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
17126 return _value;
17127 }
17128 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
17129 base_t::arec_set(index,a,p);
17130 }
17131 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t&)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
17132 if(this->is_unique()){
17133 _size-=size;
17134 self_changed();
17135 return this;
17136 }
17137 else
17138 return get<same_value_compress_string_data_t<char_T>>(_size-size,_value);
17139 }
17140 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t&)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
17141 if(this->is_unique()){
17142 _size-=size;
17143 self_changed();
17144 return this;
17145 }
17146 else
17147 return get<same_value_compress_string_data_t<char_T>>(_size-size,_value);
17148 }
17149 protected:
17150 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
17151 return hash.repeat_times(_value,_size);
17152 }
17153 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,[[maybe_unused]]size_t pos,size_t size)noexcept(hash_nothrow)override final{
17154 return hash.merge_array_hash_results(before,before_size,hash.repeat_times(_value,size),size);
17155 }
17156 protected:
17157 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
17158 return true;//总size被保证一样
17159 }
17160 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form([[maybe_unused]]size_t begin)noexcept override final{
17161 if constexpr(construct<char_T>.trivial<const char_T&> && destruct.trivial<char_T>){
17162 constexpr size_t data_size=512;
17163 static char_T data[data_size];
17164 if(data[0]!=_value)
17165 copy_assign[data_size](_value,note::to(data));
17166 return {data,note::size(min(_size-begin,data_size))};
17167 }
17168 else
17169 return {&_value,note::size<size_t>(1)};
17170 }
17171 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
17172 auto wp=down_cast<this_t*>(with.get());
17173 return equal(_value,wp->_value);
17174 }
17175 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
17176 auto wp=down_cast<this_t*>(with.get());
17177 return compare(_value,wp->_value);
17178 }
17179 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
17180 return float_size_of(*this);
17181 }
17182 };
17183
17184 //file_end
17185
17186 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
17187 }
17188
17189 //file_end
17190
17191 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/defs.hpp"
17192 template<typename char_T>
17193 struct string_t{
17194 static_assert(type_info<char_T> != type_info<const char_T>);
17195
17197 typedef base_t_w::ptr_t ptr_t;
17198 typedef base_t_w::string_view_t string_view_t;
17201 typedef char_T value_type;
17203 typedef size_t size_type;
17204 static constexpr size_t npos = range_n::npos;
17205
17206 private:
17207 //_cso_info用于存储不同cso情况下string所用到的数据
17208 mutable union _cso_info_t{
17209 ptr_t _mptr;
17210 const constexpr_str_t* _str;
17211 char_T _ch;
17212
17213 push_and_disable_msvc_warning(26495);//未初始化警告diss
17214 constexpr _cso_info_t()noexcept{}
17215 constexpr _cso_info_t(const _cso_info_t&a)noexcept{
17216 copy_assign[sizeof(_cso_info_t)](cast_to_data(this),cast_to_data(&a));
17217 }
17219 constexpr void operator=(const _cso_info_t&a)noexcept{
17220 copy_assign[sizeof(_cso_info_t)](cast_to_data(this),cast_to_data(&a));
17221 }
17222 ~_cso_info_t()noexcept{}
17223 }_cso_info{};
17224 //_cso_flags用于标识不同的cso情况
17225 mutable struct _cso_flags_t{
17226 bool _cso_flag=0;
17227 bool _str_cso_flag=0;
17228 }_cso_flags;
17229
17230 //非cso情况下的成员宏,表示一个指向string data的智能指针
17231 #define _m _cso_info._mptr
17232
17233 //BLOCK: 对成员宏`_m`的生命周期手动管理的函数族
17234
17235 //结束成员宏`_m`的生命周期
17236 constexpr void _ncso_destruct_mptr()const noexcept{destruct(&_m);}
17237 //开始成员宏`_m`的生命周期
17238 constexpr void _ncso_construct_mptr()const noexcept{construct<ptr_t>[&_m]();}
17239 //以特定初始值开始成员宏`_m`的生命周期
17240 constexpr void _ncso_construct_mptr(ptr_t p)const noexcept{construct<ptr_t>[&_m](p);}
17241
17242 //END_BLOCK
17243
17244 //BLOCK: cso情况判断函数族
17245 [[nodiscard]]bool _in_cso()const noexcept{return _cso_flags._cso_flag;}
17246 [[nodiscard]]bool _in_str_cso()const noexcept{return _in_cso() && _cso_flags._str_cso_flag;}
17247 [[nodiscard]]bool _in_chr_cso()const noexcept{return _in_cso() && !_cso_flags._str_cso_flag;}
17248 //END_BLOCK
17249 //BLOCK: cso情况设定函数族
17250 constexpr void _set_str_cso()const noexcept{_cso_flags._cso_flag=1;_cso_flags._str_cso_flag=1;}
17251 constexpr void _set_chr_cso()const noexcept{_cso_flags._cso_flag=1;_cso_flags._str_cso_flag=0;}
17252 constexpr void _set_not_cso()const noexcept{_cso_flags._cso_flag=0;}
17253 //END_BLOCK
17254
17255 //BLOCK: cso情况下的信息获取函数族
17256 [[nodiscard]]const char_T* _get_cso_data()const noexcept{return _in_str_cso()?_cso_info._str->str():&_cso_info._ch;}
17257 [[nodiscard]]size_t _get_cso_size()const noexcept{return _in_str_cso()?_cso_info._str->size():1;}
17258 [[nodiscard]]hash_t _get_cso_hash()const noexcept{return _in_str_cso()?hash(_get_cso_constexpr_str()):hash(_cso_info._ch);}
17259 [[nodiscard]]constexpr_str_t& _get_cso_constexpr_str()const noexcept{return *_cso_info._str;}
17260 //END_BLOCK
17261
17262 //BLOCK: cso情况管理函数族
17263 constexpr void _cso_init(constexpr_str_t&str)noexcept{_set_str_cso();_cso_info._str=&str;}
17264 constexpr void _cso_reinit(constexpr_str_t&str)noexcept{if(!_in_cso())_ncso_destruct_mptr();_cso_init(str);}
17265 constexpr void _cso_init(char_T ch)noexcept{_set_chr_cso();_cso_info._ch=ch;}
17266 constexpr void _cso_reinit(char_T ch)noexcept{if(!_in_cso())_ncso_destruct_mptr();_cso_init(ch);}
17267 void _cso_fin(bool need_write)const noexcept{
17268 if(_in_str_cso()&&!need_write)
17269 _ncso_construct_mptr(get<constexpr_string_data_t<char_T>>(*_cso_info._str));
17270 else{
17271 auto str=string_view_t{_get_cso_data(),_get_cso_size()};
17272 _ncso_construct_mptr(get<comn_string_data_t<char_T>>(str));
17273 }
17274 _set_not_cso();
17275 }
17276 void _cso_fin(ptr_t p)noexcept{
17277 _set_not_cso();
17278 _ncso_construct_mptr(p);
17279 }
17280 //END_BLOCK
17281
17282 //BLOCK: 已知需要拷贝cso全部内容,判断是否值得结束cso的检查
17283 static constexpr bool the_size_worth_to_end_cso(size_t size)noexcept{
17284 constexpr auto max_size=max(sizeof(comn_string_data_t<char_T>)*2/sizeof(char_T),(size_t)1);
17285 return size>=max_size;
17286 }
17287 static void full_copy_cso_check(const string_t&str)noexcept{
17288 if(the_size_worth_to_end_cso(str.size()))
17289 str._cso_check();
17290 }
17291 //END_BLOCK
17292
17293 //若cso,结束它
17294 void _cso_check(bool need_write=0)const noexcept{
17295 if(_in_cso())
17296 _cso_fin(need_write);
17297 }
17298
17299 //便利用,内部使用的构造函数
17300 string_t(ptr_t str)noexcept{_ncso_construct_mptr(str);}
17301 //无论是否在cso中,都保证可以获得一个ptr
17302 [[nodiscard]]ptr_t ptr_copy()const noexcept{
17303 _cso_check();
17304 return _m;
17305 }
17306 public:
17307 //swap的内部实现
17308 void swap_with(this_t& a)noexcept{
17309 if(_in_cso()||a._in_cso()){
17310 swap(_cso_info,a._cso_info);
17311 swap(_cso_flags,a._cso_flags);
17312 }
17313 else
17314 swap(_m,a._m);
17315 }
17316
17317 //BLOCK: 构造函数
17318 constexpr string_t()noexcept:string_t(empty_constexpr_str_of<char_T>){}
17319 constexpr string_t(constexpr_str_t&str)noexcept{_cso_init(str);}
17320 string_t(string_view_t str)noexcept{_ncso_construct_mptr(get<comn_string_data_t<char_T>>(str));}
17321 string_t(const char_T* str)noexcept:string_t(string_view_t(str)){}
17322 constexpr string_t(char_T ch)noexcept{_cso_init(ch);}
17323 string_t(const string_t& str)noexcept{
17324 if(str._in_cso()){
17325 _cso_info=str._cso_info;
17326 _cso_flags=str._cso_flags;
17327 }
17328 else
17329 _ncso_construct_mptr(str._m);
17330 }
17331 string_t(string_t&& str)noexcept:string_t(){
17332 swap_with(str);
17333 }
17334 string_t(size_t size,char_T ch)noexcept{_ncso_construct_mptr(get<same_value_compress_string_data_t<char_T>>(size,ch));}
17335 string_t(char_T ch,size_t size)noexcept requires(type_info<size_t>!=type_info<char_T>):string_t(size,ch){}
17336
17337 string_t(size_t size)noexcept{_ncso_construct_mptr(get<comn_string_data_t<char_T>>(size));}
17338 //END_BLOCK
17339 //析构函数
17340 ~string_t()noexcept{if(!_in_cso())_ncso_destruct_mptr();}
17341
17342 //BLOCK: 赋值操作符
17343 string_t& operator=(const string_t& str)noexcept{re_construct[this](str);return*this;}
17344 string_t& operator=(string_t&& str)noexcept{swap_with(str);return*this;}
17345 constexpr string_t& operator=(constexpr_str_t&str)noexcept{_cso_reinit(str);return*this;}
17346 constexpr string_t& operator=(char_T ch)noexcept{_cso_reinit(ch);return*this;}
17347 //END_BLOCK
17348
17349 //BLOCK: 字符串相加操作符
17350 [[nodiscard]]string_t operator+(const string_t& str)const noexcept{
17351 full_copy_cso_check(str);
17352 if(str._in_cso())
17353 return operator+(str.to_string_view_t());
17354 else
17355 return ptr_copy()->apply_str_to_end(str._m);
17356 }
17357 [[nodiscard]]string_t operator+(string_view_t str)const noexcept{
17358 return ptr_copy()->apply_str_to_end(str);
17359 }
17360 [[nodiscard]]string_t operator+(const char_T* str)const noexcept{
17361 return *this+string_view_t(str);
17362 }
17363 friend [[nodiscard]]string_t operator+(string_view_t str1,const string_t& str2)noexcept{
17364 return str2.ptr_copy()->apply_str_to_begin(str1);
17365 }
17366 friend [[nodiscard]]string_t operator+(const char_T* str1,const string_t& str2)noexcept{
17367 return string_view_t(str1)+str2;
17368 }
17369 friend [[nodiscard]]string_t operator+(char_T ch,const string_t& str)noexcept{
17370 return string_view_t{&ch,1}+str;
17371 }
17372
17373 string_t& operator+=(const string_t&str)&noexcept{
17374 push_back(str);
17375 return *this;
17376 }
17378 push_back(str);
17379 return *this;
17380 }
17381 string_t& operator+=(const char_T* str)&noexcept{
17382 return *this+=string_view_t(str);
17383 }
17384 string_t& operator+=(char_T ch)&noexcept{
17385 return *this += string_view_t{&ch,1};
17386 }
17387 template<typename U>
17388 [[nodiscard]]string_t&& operator+(U&& b)&&noexcept_as(*this+=b) requires was_not_an_ill_form(*this+=b){ //对右值的operator+优化为operator+=
17389 *this+=b;
17390 return move(*this);
17391 }
17392 //END_BLOCK
17393
17394 //获取string占用的内存大小
17395 float_size_t memory_cost()const noexcept{
17396 if(_in_cso())
17397 return 0;
17398 else
17399 return _m->get_memory_cost();
17400 }
17401 public:
17402 //BLOCK: 比较运算符
17403 [[nodiscard]]constexpr auto operator<=>(const string_t& a)const noexcept(compare.nothrow<char_T>){
17404 if(a._in_str_cso())
17405 return operator<=>(a._get_cso_constexpr_str());
17406 elseif(a._in_cso())
17407 return operator<=>(a.to_string_view_t());
17408 auto ssize = size();
17409 auto scom = compare(ssize,a.size());//先比较大小,若需要再调用data
17410 if(scom==0){//大小相等
17411 if(!_in_cso())
17412 return _m->compare_with(a._m);
17413 elseif(_in_str_cso())
17414 return compare.reverse(a<=>_get_cso_constexpr_str());
17415 elseif(_in_cso())
17416 return compare.reverse(a<=>to_string_view_t());
17417 }
17418 return scom;
17419 }
17420 [[nodiscard]]constexpr auto operator==(const string_t& a)const noexcept(equal.nothrow<char_T>){
17421 if(a._in_str_cso())
17422 return operator==(a._get_cso_constexpr_str());
17423 elseif(a._in_cso())
17424 return operator==(a.to_string_view_t());
17425 auto ssize = size();
17426 const auto seq = equal(ssize,a.size());//先比较大小,若需要再调用data
17427 if(seq){//大小相等
17428 if(!_in_cso())
17429 return _m->equal_with(a._m);
17430 elseif(_in_str_cso())
17431 return a==_get_cso_constexpr_str();
17432 elseif(_in_cso())
17433 return a==to_string_view_t();
17434 }
17435 return seq;
17436 }
17437 [[nodiscard]]constexpr auto operator<=>(string_view_t a)const noexcept(compare.nothrow<char_T>){
17438 auto ssize = size();
17439 auto scom = compare(ssize,a.size());//先比较大小,若需要再调用data
17440 if(scom==0){
17441 if(_in_cso())
17442 return compare(data(),a.begin(),ssize);
17443 else
17444 return _m->compare_with(a);
17445 }
17446 return scom;
17447 }
17448 [[nodiscard]]constexpr auto operator==(string_view_t a)const noexcept(equal.nothrow<char_T>){
17449 auto ssize = size();
17450 const auto seq = equal(ssize,a.size());//先比较大小,若需要再调用data
17451 if(seq){
17452 if(_in_cso())
17453 return equal(data(),a.begin(),ssize);
17454 else
17455 return _m->equal_with(a);
17456 }
17457 return seq;
17458 }
17459 [[nodiscard]]constexpr auto operator<=>(constexpr_str_t&a)const noexcept(compare.nothrow<char_T>){
17460 if(_in_cso() && data()==a.str())//同起始优化
17461 return strong_ordering::equivalent;
17462 auto tmp=operator<=>((string_view_t&)a);
17463 if(tmp==0)
17464 remove_const(this)->_cso_reinit(a);
17465 return tmp;
17466 }
17467 [[nodiscard]]constexpr auto operator==(constexpr_str_t&a)const noexcept(equal.nothrow<char_T>){
17468 if(_in_cso() && data()==a.str())//同起始优化
17469 return true;
17470 const auto tmp=operator==((string_view_t&)a);
17471 if(tmp)
17472 remove_const(this)->_cso_reinit(a);
17473 return tmp;
17474 }
17475 [[nodiscard]]constexpr auto operator<=>(const char_T* a)const noexcept(compare.nothrow<char_T>){
17476 if(_in_cso())
17477 return compare(data(),size(),a,end_by_zero);
17478 else
17479 return _m->compare_with(a);
17480 }
17481 [[nodiscard]]constexpr auto operator==(const char_T* a)const noexcept(equal.nothrow<char_T>){
17482 if(_in_cso())
17483 return equal(data(),size(),a,end_by_zero);
17484 else
17485 return _m->equal_with(a);
17486 }
17487 //END_BLOCK
17488 private:
17489 [[nodiscard]]char_T* unique_c_str()noexcept{ _cso_check(1);return _m->get_unique_c_str(_m); }
17490 public:
17491 [[nodiscard]]char_T arec(size_t index)noexcept{
17492 if(_in_cso())
17493 return _get_cso_data()[index];
17494 else
17495 return _m->arec(index);
17496 }
17497 void arec_set(size_t index,char_T a)noexcept{ _cso_check(1);return _m->arec_set(index,a,_m); }
17498
17500 string_t* _to;
17501 size_t _index;
17502
17503 friend class string_t;
17504 public:
17505 arec_t(string_t* to,size_t index)noexcept:_to(to),_index(index){}
17506 arec_t(special_init_t,const arec_t&ref)noexcept:_to(ref._to),_index(ref._index){}
17507 [[nodiscard]]operator char_T()const&&noexcept{ return _to->arec(_index); }
17508 arec_t&& operator=(char_T a)&&noexcept{
17509 _to->arec_set(_index,a);
17510 return move(*this);
17511 }
17512 arec_t&& operator=(const arec_t&&ch)&&noexcept{ return move(*this).operator=(move(ch).operator char_T()); }
17513 private:
17514 [[nodiscard]]char_T* get_address()noexcept{ return _to->unique_c_str()+_index; }
17515 [[nodiscard]]const char_T* get_address()const noexcept{ return (add_const(_to))->c_str()+_index; }
17516 public:
17517 [[nodiscard]]char_T* operator&()&&noexcept{ return get_address(); }
17518 [[nodiscard]]const char_T* operator&()const&&noexcept{ return get_address(); }
17519 /*
17520 [[nodiscard]]explicit operator char_T&()&&noexcept{ return *get_address(); }
17521 [[nodiscard]]explicit operator const char_T&()const&&noexcept{ return *get_address(); }
17522 */
17523 };
17524
17525 [[nodiscard]]arec_t operator[](size_t index)noexcept{ return{this,index}; }
17526 [[nodiscard]]const arec_t operator[](size_t index)const noexcept{ return{remove_const(this),index}; }
17527
17528 //front
17529 [[nodiscard]]arec_t front()noexcept{ return{this,0}; }
17530 [[nodiscard]]const arec_t front()const noexcept{ return{remove_const(this),0}; }
17531 //back
17532 [[nodiscard]]arec_t back()noexcept{ return{this,size()-1}; }
17533 [[nodiscard]]const arec_t back()const noexcept{ return{remove_const(this),size()-1}; }
17534
17535
17536 [[nodiscard]]string_t operator+(const arec_t&& ch)const noexcept{
17537 return *this+move(ch).operator char_T();
17538 }
17539 string_t& operator+=(const arec_t&& ch)&noexcept{
17540 return *this+=move(ch).operator char_T();
17541 }
17542
17543 //floating arec.
17544 private:
17545 static constexpr bool floating_arec_result_able=was_not_an_ill_form(
17546 magic_number::linear_interpolation::get_result(declvalue(size_t),
17547 magic_number::linear_interpolation::get_k(declvalue(char_T),declvalue(char_T)),
17549 );
17550 static auto floating_arec_result_type_helper()noexcept{
17551 if constexpr(floating_arec_result_able)
17552 return magic_number::linear_interpolation::get_result(size_t{},
17553 magic_number::linear_interpolation::get_k(char_T{},char_T{}),
17554 float_t{});
17555 }
17556 typedef decltype(floating_arec_result_type_helper()) floating_arec_result_type;
17557 static constexpr bool floating_arec_set_able=was_not_an_ill_form(
17558 magic_number::linear_interpolation::get_reverse_result(
17559 magic_number::linear_interpolation::get_k(declvalue(char_T),declvalue(char_T)),
17560 declvalue(float_t),declvalue(char_T))
17561 );
17562 public:
17563 static constexpr bool floating_arec_able=floating_arec_result_able||floating_arec_set_able;
17565 string_t* _to;
17566 float_t _index;
17567 size_t _index_x1;
17568 size_t _index_x2;
17569
17570 friend class string_t;
17571 public:
17572 static constexpr bool result_able=floating_arec_result_able;
17573 static constexpr bool set_able=floating_arec_set_able;
17574
17575 floating_arec_t(string_t* to,float_t index)noexcept:_to(to),_index(index){
17576 _index_x1=static_cast<size_t>(index);
17577 _index_x2=_index_x1+1;
17578 }
17579 floating_arec_t(special_init_t,const floating_arec_t&ref)noexcept:_to(ref._to),_index(ref._index){}
17580 [[nodiscard]]operator floating_arec_result_type()const&&noexcept requires result_able{
17581 char_T y1=_to->arec(_index_x1);
17582 char_T y2=_to->arec(_index_x2);
17583 auto δx=_index-_index_x1;
17584 return magic_number::linear_interpolation::get_result(y1,
17585 magic_number::linear_interpolation::get_k(y1,y2),
17586 δx);
17587 }
17588 floating_arec_t&& operator=(floating_arec_result_type a)&&noexcept requires set_able{
17589 char_T y1=_to->arec(_index_x1);
17590 char_T y2=_to->arec(_index_x2);
17591 auto k=magic_number::linear_interpolation::get_k(y1,y2);
17592 auto δx1=_index-_index_x1;
17593 auto δx2=_index-_index_x2;
17594 y1=(char_T)magic_number::linear_interpolation::get_reverse_result(k,δx1,a);
17595 y2=(char_T)magic_number::linear_interpolation::get_reverse_result(k,δx2,a);
17596 _to->arec_set(_index_x1,y1);
17597 _to->arec_set(_index_x2,y2);
17598 return move(*this);
17599 }
17600 };
17601 [[nodiscard]]floating_arec_t operator[](float_t index)noexcept requires(floating_arec_able){ return{this,index}; }
17602 [[nodiscard]]const floating_arec_t operator[](float_t index)const noexcept requires(floating_arec_able){ return{remove_const(this),index}; }
17603
17604 //泛型arec.
17605 template<typename T> requires ::std::is_arithmetic_v<T>
17606 [[nodiscard]]auto operator[](T index)noexcept{
17607 if constexpr(::std::is_floating_point_v<T>)
17608 return operator[](static_cast<float_t>(index));
17609 else
17610 return operator[](static_cast<size_t>(index));
17611 }
17612 template<typename T> requires ::std::is_arithmetic_v<T>
17613 [[nodiscard]]const auto operator[](T index)const noexcept{
17614 if constexpr(::std::is_floating_point_v<T>)
17615 return operator[](static_cast<float_t>(index));
17616 else
17617 return operator[](static_cast<size_t>(index));
17618 }
17619
17620 [[nodiscard]]string_t substr(size_t begin,size_t size=npos)const noexcept{
17621 size=min(size,this->size()-begin);
17622 if(size){
17623 _cso_check();
17624 return _m->get_substr_data(begin,size);
17625 }
17626 else
17627 return {};
17628 }
17629 [[nodiscard]]const char_T* data()const noexcept{ if(_in_cso())return _get_cso_data();else return _m->get_data(_m); }
17630 [[nodiscard]]char_T* writeable_data()noexcept{ return unique_c_str(); }
17631 [[nodiscard]]const char_T* c_str()const noexcept{ if(_in_cso())return _get_cso_data();else return _m->get_const_c_str(_m); }
17632 [[nodiscard]]char_T* writeable_c_str()noexcept{ return unique_c_str(); }
17633 [[nodiscard]]size_t size()const noexcept{ if(_in_cso())return _get_cso_size();else return _m->get_size(); }
17634 [[nodiscard]]explicit operator bool()const noexcept{ return size(); }
17635 [[nodiscard]]bool empty()const noexcept{ return !size(); }
17636 [[nodiscard]]size_t length()const noexcept{ return size(); }
17637 void resize(size_t nsize,char_T ch)noexcept{
17638 const auto size=this->size();
17639 if(size > nsize)
17640 *this=substr(0,nsize);
17641 elseif(size == nsize)
17642 return;
17643 elseif(size){
17644 _cso_check();
17645 _m=get<end_apply_string_data_t<char_T>>(_m,nsize-size,ch);
17646 }
17647 else
17648 *this=string_t{nsize,ch};
17649 }
17650 void resize(size_t nsize)noexcept{
17651 const auto size=this->size();
17652 if(size > nsize)
17653 *this=substr(0,nsize);
17654 elseif(size == nsize)
17655 return;
17656 elseif(size){
17657 _cso_check();
17658 _m=get<end_apply_string_data_t<char_T>>(_m,nsize-size);
17659 }
17660 else
17661 *this=string_t{nsize};
17662 }
17663 void clear()noexcept{ re_construct(this); }
17664 private:
17665 struct iterator_base_t{
17666 string_t* _to;
17667 ptrdiff_t _index; //rend: -1,使用size_t也不是不可以(标准允许无符号整数溢出),但是operator<=>会出问题
17668
17669 [[nodiscard]]constexpr iterator_base_t get_before()const noexcept{ return{_to,_index-1}; }
17670 [[nodiscard]]constexpr iterator_base_t get_next()const noexcept{ return{_to,_index+1}; }
17671 [[nodiscard]]arec_t get_value()noexcept{ return (*_to)[_index]; }
17672 [[nodiscard]]const arec_t get_value()const noexcept{ return (*add_const(_to))[_index]; }
17673 [[nodiscard]]char_T* get_handle()noexcept{ return &get_value(); }
17674 [[nodiscard]]const char_T* get_handle()const noexcept{ return &get_value(); }
17675 [[nodiscard]]constexpr bool operator==(const iterator_base_t& a)const noexcept{ return _to==a._to && _index==a._index; }
17676 [[nodiscard]]constexpr auto operator<=>(const iterator_base_t& a)const noexcept{ return _to==a._to ? _index<=>a._index : partial_ordering::unordered; }
17677 };
17678 [[nodiscard]]iterator_base_t get_iterator_data_at(ptrdiff_t index)const noexcept{ return iterator_base_t{(string_t*)this,index}; }
17679 public:
17680 typedef iterator_t<char_T,iterator_base_t> iterator;
17681 typedef const_iterator_t<char_T,const iterator_base_t> const_iterator;
17682
17683 [[nodiscard]]iterator get_iterator_at(ptrdiff_t index)noexcept{ return get_iterator_data_at(index); }
17684 [[nodiscard]]const_iterator get_iterator_at(ptrdiff_t index)const noexcept{ return get_iterator_data_at(index); }
17685 [[nodiscard]]iterator begin()noexcept{ return get_iterator_at(0); }
17686 [[nodiscard]]const_iterator begin()const noexcept{ return get_iterator_at(0); }
17687 [[nodiscard]]const_iterator cbegin()const noexcept{ return begin(); }
17688 [[nodiscard]]iterator end()noexcept{ return get_iterator_at(size()); }
17689 [[nodiscard]]const_iterator end()const noexcept{ return get_iterator_at(size()); }
17690 [[nodiscard]]const_iterator cend()const noexcept{ return end(); }
17691
17692 typedef reverse_iterator_t<char_T,iterator_base_t> reverse_iterator;
17693 typedef reverse_const_iterator_t<char_T,const iterator_base_t> reverse_const_iterator;
17694
17695 [[nodiscard]]reverse_iterator get_reverse_iterator_at(ptrdiff_t index)noexcept{ return get_iterator_data_at(index); }
17696 [[nodiscard]]reverse_const_iterator get_reverse_iterator_at(ptrdiff_t index)const noexcept{ return get_iterator_data_at(index); }
17697 [[nodiscard]]reverse_iterator rbegin()noexcept{ return get_reverse_iterator_at(size()-1); }
17698 [[nodiscard]]reverse_const_iterator rbegin()const noexcept{ return get_reverse_iterator_at(size()-1); }
17699 [[nodiscard]]reverse_const_iterator rcbegin()const noexcept{ return rbegin(); }
17700 [[nodiscard]]reverse_iterator rend()noexcept{ return get_reverse_iterator_at(-1); }
17701 [[nodiscard]]reverse_const_iterator rend()const noexcept{ return get_reverse_iterator_at(-1); }
17702 [[nodiscard]]reverse_const_iterator rcend()const noexcept{ return rend(); }
17703
17704 //
17705
17706 void push_back(const string_t& str)&noexcept{
17707 full_copy_cso_check(*this);
17708 full_copy_cso_check(str);
17709 if(_in_cso()&&!str._in_cso())
17710 _cso_fin(str._m->apply_str_to_begin(to_string_view_t()));
17711 elseif(str._in_cso()){
17712 push_back(str.to_string_view_t());
17713 }
17714 else{
17715 _cso_check();
17716 _m=_m->apply_str_to_end(str._m);
17717 }
17718 }
17719 void push_back(string_view_t str)&noexcept{ _cso_check();_m=_m->apply_str_to_end(str); }
17720 void push_back(char_T ch)&noexcept{ push_back(string_view_t{&ch,1}); }
17721 void push_back(const arec_t&& ch)&noexcept{ push_back(move(ch).operator char_T()); }
17722 void push_back(const char_T* str)&noexcept{ push_back(string_view_t(str)); }
17723
17724 void push_front(const string_t& str)&noexcept{
17725 full_copy_cso_check(*this);
17726 full_copy_cso_check(str);
17727 if(_in_cso()&&!str._in_cso())
17728 _cso_fin(str._m->apply_str_to_end(to_string_view_t()));
17729 elseif(str._in_cso()){
17730 push_front(str.to_string_view_t());
17731 }
17732 else{
17733 _cso_check();
17734 _m=_m->apply_str_to_begin(str._m);
17735 }
17736 }
17737 void push_front(string_view_t str)&noexcept{ _cso_check();_m=_m->apply_str_to_begin(str); }
17738 void push_front(char_T ch)&noexcept{ push_front(string_view_t{&ch,1}); }
17739 void push_front(const arec_t&& ch)&noexcept{ push_front(move(ch).operator char_T()); }
17740 void push_front(const char_T* str)&noexcept{ push_front(string_view_t(str)); }
17741
17742 string_t pop_back(size_t size)noexcept{ _cso_check();return _m->do_pop_back(size,_m); }
17743 string_t pop_front(size_t size)noexcept{ _cso_check();return _m->do_pop_front(size,_m); }
17744 char_T pop_back()noexcept{ return pop_back(1)[0]; }
17745 char_T pop_front()noexcept{ return pop_front(1)[0]; }
17746
17747 //
17748
17749 [[nodiscard]]operator string_view_t()const&noexcept{ return string_view_t{data(),size()}; }
17750 [[nodiscard]]auto to_string_view_t()const&noexcept{ return operator string_view_t(); }
17751 [[nodiscard]]auto view()&noexcept{ return array_like_view_t<char_T>{writeable_data(),size()}; }
17752 [[nodiscard]]auto view()const&noexcept{ return array_like_view_t<const char_T>{data(),size()}; }
17753 [[nodiscard]]explicit operator hash_t()const noexcept{ return _in_cso()?_get_cso_hash():_m->get_hash(_m); }
17754
17755 //
17756 static constexpr bool find_nothrow=equal.nothrow<char_T>;
17757 [[nodiscard]]size_t find(const char_T ch,size_t begin=0)const noexcept(find_nothrow){
17758 return in_range_size_t(ch, to_string_view_t().substr(begin));
17759 }
17760 [[nodiscard]]size_t reverse_find(const char_T ch)const noexcept(find_nothrow){
17761 return in_range_but_reverse_size_t(ch, to_string_view_t());
17762 }
17763 [[nodiscard]]size_t find(string_view_t str,size_t begin=0)const noexcept(find_nothrow){
17764 return in_range_size_t(str, to_string_view_t().substr(begin));
17765 }
17766 [[nodiscard]]size_t reverse_find(string_view_t str)const noexcept(find_nothrow){
17767 return in_range_but_reverse_size_t(str, to_string_view_t());
17768 }
17769 [[nodiscard]]size_t find(constexpr_str_t&str,size_t begin=0)const noexcept(find_nothrow){
17770 return in_range_size_t(str, to_string_view_t().substr(begin));
17771 }
17772 [[nodiscard]]size_t reverse_find(constexpr_str_t&str)const noexcept(find_nothrow){
17773 return in_range_but_reverse_size_t(str, to_string_view_t());
17774 }
17775 [[nodiscard]]size_t find(const string_t&str,size_t begin=0)const noexcept(find_nothrow){
17776 if(str._in_cso()){
17777 if(str._in_str_cso())
17778 return find(str._get_cso_constexpr_str(),begin);
17779 elseif(str._in_cso())
17780 return find(str._cso_info._ch,begin);
17781 }
17782 auto result = str._m->get_match_pattern_from_self(str._m).match(to_string_view_t().substr(begin));
17783 if(result)
17784 return result - data();
17785 else
17786 return npos;
17787 }
17788 [[nodiscard]]size_t reverse_find(const string_t&str)const noexcept(find_nothrow){
17789 if(str._in_cso()){
17790 if(str._in_str_cso())
17791 return reverse_find(str._get_cso_constexpr_str());
17792 elseif(str._in_cso())
17793 return reverse_find(str._cso_info._ch);
17794 }
17795 auto result = str._m->get_reverse_match_pattern_from_self(str._m).match(to_string_view_t());
17796 if(result)
17797 return result - data();
17798 else
17799 return npos;
17800 }
17801 //
17802 [[nodiscard]]size_t find_first_of(string_view_t str)const noexcept(find_nothrow){
17803 return range_n::find_first_of_size_t(str,to_string_view_t());
17804 }
17805 [[nodiscard]]size_t find_first_of(constexpr_str_t&str)const noexcept(find_nothrow){
17806 return range_n::find_first_of_size_t(str,to_string_view_t());
17807 }
17808 [[nodiscard]]size_t find_first_of(const string_t&str)const noexcept(find_nothrow){
17809 if(str._in_cso()){
17810 if(str._in_str_cso())
17811 return find_first_of(str._get_cso_constexpr_str());
17812 elseif(str._in_cso())
17813 return find(str._cso_info._ch);
17814 }
17815 return find_first_of(str.to_string_view_t());
17816 }
17817 [[nodiscard]]size_t find_first_of(const char_T*str)const noexcept(find_nothrow){
17818 return find_first_of(string_view_t(str));
17819 }
17820 [[nodiscard]]size_t find_first_of(char_T ch)const noexcept(find_nothrow){
17821 return find(ch);
17822 }
17823 [[nodiscard]]size_t find_first_of(const arec_t&&ch)const noexcept(find_nothrow){
17824 return find(move(ch).operator char_T());
17825 }
17826 [[nodiscard]]size_t find_first_not_of(string_view_t str)const noexcept(find_nothrow){
17827 return range_n::find_first_not_of_size_t(str,to_string_view_t());
17828 }
17829 [[nodiscard]]size_t find_first_not_of(constexpr_str_t&str)const noexcept(find_nothrow){
17830 return range_n::find_first_not_of_size_t(str,to_string_view_t());
17831 }
17832 [[nodiscard]]size_t find_first_not_of(const string_t&str)const noexcept(find_nothrow){
17833 if(str._in_cso()){
17834 if(str._in_str_cso())
17835 return find_first_not_of(str._get_cso_constexpr_str());
17836 elseif(str._in_cso())
17837 return find_first_not_of(str.to_string_view_t());
17838 }
17839 return find_first_not_of(str.to_string_view_t());
17840 }
17841 [[nodiscard]]size_t find_first_not_of(const char_T*str)const noexcept(find_nothrow){
17842 return find_first_not_of(string_view_t(str));
17843 }
17844 [[nodiscard]]size_t find_first_not_of(char_T ch)const noexcept(find_nothrow){
17845 return find_first_not_of(string_view_t(ch));
17846 }
17847 [[nodiscard]]size_t find_first_not_of(const arec_t&&ch)const noexcept(find_nothrow){
17848 return find_first_not_of(string_view_t(move(ch).operator char_T()));
17849 }
17850 [[nodiscard]]size_t find_last_of(string_view_t str)const noexcept(find_nothrow){
17851 return range_n::find_last_of_size_t(str,to_string_view_t());
17852 }
17853 [[nodiscard]]size_t find_last_of(constexpr_str_t&str)const noexcept(find_nothrow){
17854 return range_n::find_last_of_size_t(str,to_string_view_t());
17855 }
17856 [[nodiscard]]size_t find_last_of(const string_t&str)const noexcept(find_nothrow){
17857 if(str._in_cso()){
17858 if(str._in_str_cso())
17859 return find_last_of(str._get_cso_constexpr_str());
17860 elseif(str._in_cso())
17861 return reverse_find(str._cso_info._ch);
17862 }
17863 return find_last_of(str.to_string_view_t());
17864 }
17865 [[nodiscard]]size_t find_last_of(const char_T*str)const noexcept(find_nothrow){
17866 return find_last_of(string_view_t(str));
17867 }
17868 [[nodiscard]]size_t find_last_of(char_T ch)const noexcept(find_nothrow){
17869 return reverse_find(ch);
17870 }
17871 [[nodiscard]]size_t find_last_of(const arec_t&&ch)const noexcept(find_nothrow){
17872 return reverse_find(move(ch).operator char_T());
17873 }
17874 [[nodiscard]]size_t find_last_not_of(string_view_t str)const noexcept(find_nothrow){
17875 return range_n::find_last_not_of_size_t(str,to_string_view_t());
17876 }
17877 [[nodiscard]]size_t find_last_not_of(constexpr_str_t&str)const noexcept(find_nothrow){
17878 return range_n::find_last_not_of_size_t(str,to_string_view_t());
17879 }
17880 [[nodiscard]]size_t find_last_not_of(const string_t&str)const noexcept(find_nothrow){
17881 if(str._in_cso()){
17882 if(str._in_str_cso())
17883 return find_last_not_of(str._get_cso_constexpr_str());
17884 elseif(str._in_cso())
17885 return find_last_not_of(str.to_string_view_t());
17886 }
17887 return find_last_not_of(str.to_string_view_t());
17888 }
17889 [[nodiscard]]size_t find_last_not_of(const char_T*str)const noexcept(find_nothrow){
17890 return find_last_not_of(string_view_t(str));
17891 }
17892 [[nodiscard]]size_t find_last_not_of(char_T ch)const noexcept(find_nothrow){
17893 return find_last_not_of(string_view_t{&ch,1});
17894 }
17895 [[nodiscard]]size_t find_last_not_of(const arec_t&&ch)const noexcept(find_nothrow){
17896 return find_last_not_of(move(ch).operator char_T());
17897 }
17898
17899 //
17900
17901 [[nodiscard]]string_t arec(size_t index,char_T delimiter)const{
17902 auto pos=find(delimiter);
17903 auto end=find(delimiter,pos);
17904 while(index--){
17905 pos=end;
17906 end=find(delimiter,pos);
17907 }
17908 return substr(pos,end-pos);
17909 }
17910 [[nodiscard]]string_t arec(size_t index,string_view_t delimiter_str)const{
17911 auto pos=find(delimiter_str);
17912 auto end=find(delimiter_str,pos);
17913 while(index--){
17914 pos=end;
17915 end=find(delimiter_str,pos);
17916 }
17917 return substr(pos,end-pos);
17918 }
17919 [[nodiscard]]string_t arec(size_t index,const string_t&delimiter_str)const{
17920 auto pos=find(delimiter_str);
17921 auto end=find(delimiter_str,pos);
17922 while(index--){
17923 pos=end;
17924 end=find(delimiter_str,pos);
17925 }
17926 return substr(pos,end-pos);
17927 }
17928 [[nodiscard]]string_t arec(size_t index,constexpr_str_t&delimiter_str)const{
17929 auto pos=find(delimiter_str);
17930 auto end=find(delimiter_str,pos);
17931 while(index--){
17932 pos=end;
17933 end=find(delimiter_str,pos);
17934 }
17935 return substr(pos,end-pos);
17936 }
17937
17938 //
17939
17940 void erase(size_t pos,size_t size=1)&noexcept{
17941 _cso_check();_m=_m->do_erase(pos,size);
17942 }
17943 void insert(size_t pos,const string_t& str)&noexcept{
17944 _cso_check();
17945 full_copy_cso_check(str);
17946 if(str._in_cso())
17947 _m=_m->do_insert(pos,str.to_string_view_t());
17948 else
17949 _m=_m->do_insert(pos,str);
17950 }
17951 void insert(size_t pos,string_view_t str)&noexcept{
17952 _cso_check();_m=_m->do_insert(pos,str);
17953 }
17954 void insert(size_t pos,const char_T* str)&noexcept{
17955 insert(pos,string_view_t(str));
17956 }
17957 void insert(size_t pos,char_T ch)&noexcept{
17958 insert(pos,string_view_t{&ch,1});
17959 }
17960
17961 //
17962
17963 //contains
17964 constexpr bool contains(string_view_t str)const noexcept{
17965 return find(str) != npos;
17966 }
17967 constexpr bool contains(constexpr_str_t&str)const noexcept{
17968 return find(str) != npos;
17969 }
17970 constexpr bool contains(const string_t&str)const noexcept{
17971 return find(str) != npos;
17972 }
17973 constexpr bool contains(char_T ch)const noexcept{
17974 return find(ch) != npos;
17975 }
17976 constexpr bool contains(const char_T*str)const noexcept{
17977 return find(str) != npos;
17978 }
17979
17980 //starts_with
17981 constexpr bool starts_with(string_view_t str)const noexcept{
17982 if(size()<str.size())
17983 return false;
17984 return substr(0,str.size()) == str;
17985 }
17986 constexpr bool starts_with(constexpr_str_t&str)const noexcept{
17987 if(size()<str.size())
17988 return false;
17989 return substr(0,str.size()) == str;
17990 }
17991 constexpr bool starts_with(const string_t&str)const noexcept{
17992 if(size()<str.size())
17993 return false;
17994 if(str._in_chr_cso())
17995 return starts_with(str._cso_info._ch);
17996 else
17997 return substr(0,str.size()) == str;
17998 }
17999 constexpr bool starts_with(char_T ch)const noexcept{
18000 if(size()<1)
18001 return false;
18002 return operator[](0) == ch;
18003 }
18004 constexpr bool starts_with(const char_T*str)const noexcept{
18005 return starts_with(string_view_t{str});
18006 }
18007
18008 //ends_with
18009 constexpr bool ends_with(string_view_t str)const noexcept{
18010 if(size()<str.size())
18011 return false;
18012 return substr(size()-str.size()) == str;
18013 }
18014 constexpr bool ends_with(constexpr_str_t&str)const noexcept{
18015 if(size()<str.size())
18016 return false;
18017 return substr(size()-str.size()) == str;
18018 }
18019 constexpr bool ends_with(const string_t&str)const noexcept{
18020 if(size()<str.size())
18021 return false;
18022 if(str._in_chr_cso())
18023 return ends_with(str._cso_info._ch);
18024 else
18025 return substr(size()-str.size()) == str;
18026 }
18027 constexpr bool ends_with(char_T ch)const noexcept{
18028 if(size()<1)
18029 return false;
18030 return operator[](size()-1) == ch;
18031 }
18032 constexpr bool ends_with(const char_T*str)const noexcept{
18033 return ends_with(string_view_t{str});
18034 }
18035
18036 this_t& append(size_t size,char_T ch)noexcept{
18037 return *this+=string_t{size,ch};
18038 }
18039 /*
18040 compare
18041 replace
18042 */
18043 #undef _m
18044 };
18045
18046 //推导指引
18047 template<class char_T>
18048 string_t(const char_T*) -> string_t<char_T>;
18049 template<class char_T>
18051
18052 //string的swap特化
18053 template<typename T>
18054 inline void swap(string_t<T>& a,string_t<T>& b)noexcept{ a.swap_with(b); }
18055
18056 //std ostream支持
18057 template<typename some_fucking_std_ostream, typename T>
18058 decltype(auto) operator<<(some_fucking_std_ostream& stream, const string_t<T>& str){
18059 typedef some_fucking_std_ostream stream_t;
18060 typedef stream_t::traits_type traits_t;
18061 typename stream_t::iostate state = stream_t::goodbit;
18062
18063 suppress_msvc_warning(26494);//未初始化警告diss
18064 size_t pad;
18065 size_t size = str.size();
18066 if(stream.width() <= 0 || static_cast<size_t>(stream.width()) <= size)
18067 pad = 0;
18068 else
18069 pad = static_cast<size_t>(stream.width()) - size;
18070
18071 const typename stream_t::sentry isok(stream);
18072
18073 if(!isok)
18074 state |= stream_t::badbit;
18075 else {
18076 try {
18077 if((stream.flags() & stream_t::adjustfield) != stream_t::left){
18078 for(; 0 < pad; --pad){ // pad on left
18079 if(traits_t::eq_int_type(traits_t::eof(), stream.rdbuf()->sputc(stream.fill()))){
18080 state |= stream_t::badbit; // insertion failed, quit
18081 break;
18082 }
18083 }
18084 }
18085
18086 if(state == stream_t::goodbit && stream.rdbuf()->sputn(str.c_str(), static_cast<::std::streamsize>(size)) != static_cast<::std::streamsize>(size))
18087 state |= stream_t::badbit;
18088 else {
18089 for(; 0 < pad; --pad){ // pad on right
18090 if(traits_t::eq_int_type(traits_t::eof(), stream.rdbuf()->sputc(stream.fill()))){
18091 state |= stream_t::badbit; // insertion failed, quit
18092 break;
18093 }
18094 }
18095 }
18096
18097 stream.width(0);
18098 }
18099 catch(...){
18100 stream.setstate(stream_t::badbit, true);
18101 return stream;
18102 }
18103 }
18104 stream.setstate(state);
18105 return stream;
18106 }
18107
18108 //array like支持
18109 template<class T>
18110 [[nodiscard]]inline auto size_of_array_like(const string_t<remove_cv<T>>& a)noexcept{ return a.size(); }
18111 template<class T>
18112 [[nodiscard]]inline auto begin_of_array_like(string_t<remove_cv<T>>& a)noexcept{ return a.c_str(); }
18113 template<class T>
18114 [[nodiscard]]inline auto begin_of_array_like(const string_t<remove_cv<T>>& a)noexcept{ return a.c_str(); }
18115
18116 //typedef
18117 typedef string_t<char_t>string;
18118 }
18119 using string_n::string_t;
18120 using string_n::string;
18121
18122 //file_end
18123
18124 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
18125
18126 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
18127 //_undefs.hpp
18128 /*
18129 未完成的elc解释器basic文件
18130 由steve02081504与Alex0125设计、编写
18131 转载时请在不对此文件做任何修改的同时注明出处
18132 项目地址:https://github.com/steve02081504/ELC
18133 */
18134 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
18135 //_undefs.hpp
18136 /*
18137 未完成的elc解释器_share文件
18138 由steve02081504与Alex0125设计、编写
18139 转载时请在不对此文件做任何修改的同时注明出处
18140 项目地址:https://github.com/steve02081504/ELC
18141 */
18142
18143 //defs at "_defs.hpp"
18144
18145 #if defined(_MSC_VER)
18146 #pragma warning(pop)
18147 #endif
18148 #undef suppress_msvc_warning
18149 #undef disable_msvc_warning
18150 #undef push_msvc_warning
18151 #undef pop_msvc_warning
18152 #undef push_and_disable_msvc_warning
18153
18154 //for basic_environment.hpp
18155 #undef BIT_POSSIBILITY
18156 //
18157 #if defined(ELC_VOID_NAME)
18158 #define void the_void
18159 #endif
18160
18161 // #undef often_noexcept
18162 #undef noexcept_as
18163 #undef noexcept_as_auto
18164 #undef constexpr_as
18165 #undef constexpr_as_auto
18166
18167 #undef using_method_from_base_t
18168 #undef using_method_from_value
18169
18170 #undef floop
18171 #undef enable_adl
18172
18173 #undef re_declvalue
18174 #undef re_decltype
18175
18176 #undef declvalue
18177
18178 #undef template_error
18179 #undef template_warning
18180
18181 #undef type_info_of
18182 #undef type_name_of
18183
18184 #undef is_common_attribute
18185 #undef is_special_attribute
18186
18187 #undef has_attribute
18188 #undef not_has_attribute
18189
18190 #undef float_size_of
18191 #undef bitnum_of
18192
18193 #undef def_common_attribute_with_nothing
18194 #undef def_special_attribute_with_nothing
18195
18196 #undef common_attribute_t
18197 #undef special_attribute_t
18198
18199 #undef enable_if
18200 #undef enabled_by_default
18201 #undef disabled_by_default
18202 #undef enable_if_not_ill_form
18203 #undef enable_flag
18204
18205 #undef was_an_ill_form
18206 #undef was_an_ill_form_with_parameter
18207 #undef was_not_an_ill_form
18208 #undef was_not_an_ill_form_and_noexcept
18209 #undef was_not_an_ill_form_with_parameter
18210
18211 #undef recursive_lambda
18212 #undef get_recursive_lambda_caller
18213 #undef lambda
18214 #undef lambda_with_catch
18215 #undef self_recursion
18216 #undef lambda_RLSRRS
18217
18218 #undef MAGIC
18219
18220 #undef nothing
18221
18222 #undef elseif
18223 #undef _big_than_
18224 #undef _small_than_
18225
18226 #if defined(_MSC_VER)
18227 #undef not
18228 #undef and
18229 #undef or
18230 #endif
18231
18232 #undef INTER_NAMESPACE
18233 #undef BREAK_NAMESPACE
18234
18235 #undef szie
18236 #undef form
18237
18238 #undef template_name
18239 #undef type_name
18240
18241 #undef not_in_debug
18242
18243 #undef es
18244 #undef ec
18245
18246 #undef ELC_TEST_EVENTNAME
18247
18248 #undef override_instance_struct
18249
18250 #undef distinctive
18251
18252 #undef force_inline
18253
18254 #undef with_no_vtable
18255
18256 #undef in_consteval
18257
18258 #undef no_vtable_struct
18259 #undef no_vtable_class
18260
18261 //file_end
18262
18263 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
18264
18265 //file_end
18266
18267 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
18268 }
18269 //strings
18270 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18271 //str_code_convert.hpp
18272 /*
18273 未完成的elc解释器_share文件
18274 由steve02081504与Alex0125设计、编写
18275 转载时请在不对此文件做任何修改的同时注明出处
18276 项目地址:https://github.com/steve02081504/ELC
18277 */
18278 /*
18279 APIs说明
18280 elc依赖的基础函数.
18281 调整这些,实现快速移植,快速优化与行为自定义.
18282 */
18283 #if !defined(ELC_APIS_str_code_convert)
18284 #define ELC_APIS_str_code_convert
18285 #include <cuchar>
18286 #include <clocale>
18287 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
18288 //default_data_type.hpp
18289 /*
18290 未完成的elc解释器_share文件
18291 由steve02081504与Alex0125设计、编写
18292 转载时请在不对此文件做任何修改的同时注明出处
18293 项目地址:https://github.com/steve02081504/ELC
18294 */
18295 namespace elc{
18296 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
18297 typedef char32_t char_t;
18298 /*ELC内部钦定int_t类型*/
18299 typedef int64_t int_t;
18300 /*ELC内部钦定uint_t类型*/
18301 typedef uint64_t uint_t;
18302 /*ELC内部钦定float_t类型*/
18303 typedef double float_t;
18304 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
18305 typedef long double float_size_t;
18306 }
18307
18308 //file_end
18309
18310 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18311 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
18312 //string
18313 //at namespace ::
18314 /*
18315 未完成的elc解释器include文件
18316 由steve02081504与Alex0125设计、编写
18317 转载时请在不对此文件做任何修改的同时注明出处
18318 项目地址:https://github.com/steve02081504/ELC
18319 */
18320 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
18321
18322 //file_end
18323
18324 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18326 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18327 //_defs.hpp
18328 /*
18329 未完成的elc解释器_share文件
18330 由steve02081504与Alex0125设计、编写
18331 转载时请在不对此文件做任何修改的同时注明出处
18332 项目地址:https://github.com/steve02081504/ELC
18333 */
18334
18335 //undefs at "_undefs.hpp"
18336
18337 //set ELC_WARNING_LEVEL default to 4(max)
18338 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18339
18340 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
18341 //basic_environment.hpp
18342 /*
18343 未完成的elc解释器_share文件
18344 由steve02081504与Alex0125设计、编写
18345 转载时请在不对此文件做任何修改的同时注明出处
18346 项目地址:https://github.com/steve02081504/ELC
18347 */
18348
18349 //每个bit(不是字节)的可能性
18350 //为什么c艹委员会不定义这个?
18351 #define BIT_POSSIBILITY 2
18352
18353 //file_end
18354
18355 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18356
18357 #if defined(_MSC_VER)
18358 #pragma warning(push,ELC_WARNING_LEVEL)
18359 #pragma warning(disable:4099)//class与struct混用警告diss
18360 #pragma warning(disable:26812)//enum class安利diss.
18361 #pragma warning(disable:4584)//重复子类警告diss
18362 #pragma warning(disable:4250)//域控制继承警告diss
18363 #pragma warning(disable:26432)//不完全默认方法警告diss
18364 #pragma warning(disable:26435)//virtual override方法警告diss
18365 #pragma warning(disable:26481)//容器安利diss
18366 #pragma warning(disable:26446)//gsl::at安利diss
18367 #pragma warning(disable:26434)//方法覆盖警告diss
18368 #pragma warning(disable:26429)//gsl::not_null安利diss
18369 #pragma warning(disable:26471)//对void*进行static_cast安利diss
18370 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
18371 #pragma warning(disable:26473)//相同指针显式cast警告diss
18372 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
18373 #pragma warning(disable:26485)//数组作指针警告diss
18374 #pragma warning(disable:26490)//reinterpret_cast警告diss
18375 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
18376 #pragma warning(disable:26482)//非常数数组索引警告diss
18377 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
18378 #endif
18379 #if defined(_MSC_VER)
18380 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
18381 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
18382 #define push_msvc_warning() __pragma(warning(push))
18383 #define pop_msvc_warning() __pragma(warning(pop))
18384 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
18385 #else
18386 #define suppress_msvc_warning(...)
18387 #define disable_msvc_warning(...)
18388 #define push_msvc_warning()
18389 #define pop_msvc_warning()
18390 #define push_and_disable_msvc_warning(...)
18391 #endif
18392 //
18393 #if defined(ELC_VOID_NAME)
18394 #undef void
18395 #endif
18396
18397 // #define often_noexcept
18398 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
18399 #define noexcept_as_auto MAGIC//哦现在有了
18400 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
18401 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
18402
18403 #define using_method_from_base_t(name,...) \
18404 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
18405 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
18406 {\
18407 return base_t::name(forward<Args>(rest)...);\
18408 }\
18409
18410 #define using_method_from_value(name,value_name,...) \
18411 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
18412 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
18413 {\
18414 return value_name.name(forward<Args>(rest)...);\
18415 }\
18416
18417 #define floop while(__builtin_is_my_dick_still_there())
18418 #define enable_adl(name) void name()noexcept=delete
18419
18420 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
18421 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
18422
18423 #define declvalue(...) (::std::declval<__VA_ARGS__>())
18424
18425 /*实例化到此将引发错误*/
18426 #define template_error(reason) static_assert(template_error_helper<T>,reason)
18427 /*实例化到此将引发警告*/
18428 #define template_warning(reason) template_warning_helper<T>(reason)
18429
18430 //for type_info
18431 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
18432 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
18433
18434 #define is_common_attribute(name) public attribute<T,name<T>>
18435 #define is_special_attribute(name) public attribute<T,name>
18436
18437 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
18438 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
18439
18440 //for float_size_t
18441 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
18442 //bitnum_of
18443 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
18444
18445 //for attribute
18446 #define def_common_attribute_with_nothing(name) \
18447 template<typename T>\
18448 class name{}\
18449
18450 #define def_special_attribute_with_nothing(name) \
18451 class name{}\
18452
18453 #define common_attribute_t template<class>class
18454 #define special_attribute_t class
18455
18456 /*
18457 若参数的布尔值为零,那么此模板不会实例化
18458
18459 为什么不用cpp20的constraints?
18460 1.不能类内定义
18461 2.不能作为模板参数
18462 一句话总结:c艹标准会sb
18463 */
18464 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
18465 /*默认参与模板候选*/
18466 #define enabled_by_default class enable_state=void
18467 /*默认不参与模板候选*/
18468 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
18469 /*若参数为病式,那么此模板不会实例化*/
18470 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
18471 /*用于模板声明*/
18472 #define enable_flag class enable_state
18473
18474 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
18475 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
18476 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
18477 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
18478 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
18479
18480 /*让lambda递归更加美观*/
18481 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
18482 /*让lambda递归更加美观*/
18483 #define get_recursive_lambda_caller(name) \
18484 lambda_with_catch(&)(auto&&...Args){\
18485 return name(name,Args...);\
18486 }
18487 /*让lambda定义更加美观*/
18488 #define lambda []
18489 /*让lambda定义更加美观*/
18490 #define lambda_with_catch(...) [__VA_ARGS__]
18491 /*让lambda递归更加美观*/
18492 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
18493 //recursive_lambda_self_referential_reserved_symbolname
18494 #define lambda_RLSRRS _my_jb_super_sb_name_
18495
18496 #define MAGIC//ahh,ko no tenno da!
18497
18498 /*装饰性语法糖*/
18499 #define nothing
18500
18501 /*aya风格语法糖*/
18502 #define elseif else if
18503 /*aya风格语法糖*/
18504 #define _big_than_ >
18505 /*aya风格语法糖*/
18506 #define _small_than_ <
18507
18508 #if defined(_MSC_VER)
18509 #define not !
18510 #define and &&
18511 #define or ||
18512 #endif
18513
18514 /*进入名称空间,并不是很美观*/
18515 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
18516 /*退出名称空间,并不是很美观*/
18517 #define BREAK_NAMESPACE }
18518
18519 /*template说明符*/
18520 #define template_name template
18521 /*template说明符*/
18522 #define type_name class
18523
18524 #if defined(DEBUG) || defined(_DEBUG)
18525 #define not_in_debug 0
18526 #else
18527 #define not_in_debug 1
18528 #endif
18529
18530 #define es U""
18531 #define ec(ch) U ## ch
18532
18533 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
18534 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
18535 #else
18536 #define ELC_TEST_EVENTNAME(name)
18537 #endif
18538
18539 #define override_instance_struct \
18540 protected:\
18541 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
18542 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
18543 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
18544 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
18545 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
18546
18547 #if defined(_WIN32)
18548 #define distinctive __declspec(dllexport)
18549 #else
18550 #define distinctive
18551 #endif
18552
18553 #if defined(_WIN32)
18554 #define force_inline __forceinline
18555 #elif defined(__GNUC__)
18556 #define force_inline __attribute__((always_inline)) inline
18557 #else
18558 #define force_inline inline
18559 #endif
18560
18561 #if defined(_WIN32)
18562 #define with_no_vtable __declspec(novtable)
18563 #else
18564 #define with_no_vtable
18565 #endif
18566
18567 #define in_consteval (::std::is_constant_evaluated())
18568
18569 #define no_vtable_struct struct with_no_vtable
18570 #define no_vtable_class class with_no_vtable
18571
18572 //file_end
18573
18574 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18575
18576 using namespace ::elc::defs;//get def
18577
18578 [[nodiscard]]inline string_t<char> to_char_str(string_view_t<char_t> a)noexcept{
18579 string_t<char>aret;
18580 ::std::mbstate_t stat{};
18581 string_t old_lc=::std::setlocale(LC_CTYPE,nullptr);
18582 if(::std::setlocale(LC_CTYPE,"en_US.utf8")==nullptr)
18583 die_with(locale::str::setlocale_error);
18584 push_and_disable_msvc_warning(26494)//未初始化警告diss
18585 char r[MB_LEN_MAX];
18586 ptrdiff_t s;
18588 for(auto c:a){
18589 s=::std::c32rtomb(r,c,&stat);
18590 if(s < 0)//-1
18591 die_with(locale::str::code_convert_error);
18592 aret+=string_view_t<char>{(char*)r,note::size((size_t)s)};
18593 }
18594 ::std::setlocale(LC_CTYPE,old_lc.c_str());
18595 return aret;
18596 }
18597 [[nodiscard]]inline string_t<char_t> to_char_t_str(string_view_t<char> a)noexcept{
18598 string_t<char_t>aret;
18599 ::std::mbstate_t stat{};
18600 string_t old_lc=::std::setlocale(LC_CTYPE,nullptr);
18601 if(::std::setlocale(LC_CTYPE,"en_US.utf8")==nullptr)
18602 die_with(locale::str::setlocale_error);
18603 push_and_disable_msvc_warning(26494);//未初始化警告diss
18604 char_t c;
18605 ptrdiff_t s;
18607 auto i=a.cbegin(),e=a.cend();
18608 while(i!=e){
18609 s=::std::mbrtoc32(&c,i,MB_LEN_MAX,&stat);
18610 if(s < 0)//-3 或 -1
18611 die_with(locale::str::code_convert_error);
18612 i+=s;
18613 aret+=c;
18614 }
18615 ::std::setlocale(LC_CTYPE,old_lc.c_str());
18616 return aret;
18617 }
18618
18619 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
18620 //_undefs.hpp
18621 /*
18622 未完成的elc解释器_share文件
18623 由steve02081504与Alex0125设计、编写
18624 转载时请在不对此文件做任何修改的同时注明出处
18625 项目地址:https://github.com/steve02081504/ELC
18626 */
18627
18628 //defs at "_defs.hpp"
18629
18630 #if defined(_MSC_VER)
18631 #pragma warning(pop)
18632 #endif
18633 #undef suppress_msvc_warning
18634 #undef disable_msvc_warning
18635 #undef push_msvc_warning
18636 #undef pop_msvc_warning
18637 #undef push_and_disable_msvc_warning
18638
18639 //for basic_environment.hpp
18640 #undef BIT_POSSIBILITY
18641 //
18642 #if defined(ELC_VOID_NAME)
18643 #define void the_void
18644 #endif
18645
18646 // #undef often_noexcept
18647 #undef noexcept_as
18648 #undef noexcept_as_auto
18649 #undef constexpr_as
18650 #undef constexpr_as_auto
18651
18652 #undef using_method_from_base_t
18653 #undef using_method_from_value
18654
18655 #undef floop
18656 #undef enable_adl
18657
18658 #undef re_declvalue
18659 #undef re_decltype
18660
18661 #undef declvalue
18662
18663 #undef template_error
18664 #undef template_warning
18665
18666 #undef type_info_of
18667 #undef type_name_of
18668
18669 #undef is_common_attribute
18670 #undef is_special_attribute
18671
18672 #undef has_attribute
18673 #undef not_has_attribute
18674
18675 #undef float_size_of
18676 #undef bitnum_of
18677
18678 #undef def_common_attribute_with_nothing
18679 #undef def_special_attribute_with_nothing
18680
18681 #undef common_attribute_t
18682 #undef special_attribute_t
18683
18684 #undef enable_if
18685 #undef enabled_by_default
18686 #undef disabled_by_default
18687 #undef enable_if_not_ill_form
18688 #undef enable_flag
18689
18690 #undef was_an_ill_form
18691 #undef was_an_ill_form_with_parameter
18692 #undef was_not_an_ill_form
18693 #undef was_not_an_ill_form_and_noexcept
18694 #undef was_not_an_ill_form_with_parameter
18695
18696 #undef recursive_lambda
18697 #undef get_recursive_lambda_caller
18698 #undef lambda
18699 #undef lambda_with_catch
18700 #undef self_recursion
18701 #undef lambda_RLSRRS
18702
18703 #undef MAGIC
18704
18705 #undef nothing
18706
18707 #undef elseif
18708 #undef _big_than_
18709 #undef _small_than_
18710
18711 #if defined(_MSC_VER)
18712 #undef not
18713 #undef and
18714 #undef or
18715 #endif
18716
18717 #undef INTER_NAMESPACE
18718 #undef BREAK_NAMESPACE
18719
18720 #undef szie
18721 #undef form
18722
18723 #undef template_name
18724 #undef type_name
18725
18726 #undef not_in_debug
18727
18728 #undef es
18729 #undef ec
18730
18731 #undef ELC_TEST_EVENTNAME
18732
18733 #undef override_instance_struct
18734
18735 #undef distinctive
18736
18737 #undef force_inline
18738
18739 #undef with_no_vtable
18740
18741 #undef in_consteval
18742
18743 #undef no_vtable_struct
18744 #undef no_vtable_class
18745
18746 //file_end
18747
18748 #line 65 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18749 }
18750 namespace elc::defs{
18751 using namespace elc::APIs::str_code_convert;
18752 }
18753 #endif
18754
18755 //file_end
18756
18757 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
18758 namespace elc::defs{
18759 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
18760 //_defs.hpp
18761 /*
18762 未完成的elc解释器basic文件
18763 由steve02081504与Alex0125设计、编写
18764 转载时请在不对此文件做任何修改的同时注明出处
18765 项目地址:https://github.com/steve02081504/ELC
18766 */
18767 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18768 //_defs.hpp
18769 /*
18770 未完成的elc解释器_share文件
18771 由steve02081504与Alex0125设计、编写
18772 转载时请在不对此文件做任何修改的同时注明出处
18773 项目地址:https://github.com/steve02081504/ELC
18774 */
18775
18776 //undefs at "_undefs.hpp"
18777
18778 //set ELC_WARNING_LEVEL default to 4(max)
18779 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18780
18781 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
18782 //basic_environment.hpp
18783 /*
18784 未完成的elc解释器_share文件
18785 由steve02081504与Alex0125设计、编写
18786 转载时请在不对此文件做任何修改的同时注明出处
18787 项目地址:https://github.com/steve02081504/ELC
18788 */
18789
18790 //每个bit(不是字节)的可能性
18791 //为什么c艹委员会不定义这个?
18792 #define BIT_POSSIBILITY 2
18793
18794 //file_end
18795
18796 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18797
18798 #if defined(_MSC_VER)
18799 #pragma warning(push,ELC_WARNING_LEVEL)
18800 #pragma warning(disable:4099)//class与struct混用警告diss
18801 #pragma warning(disable:26812)//enum class安利diss.
18802 #pragma warning(disable:4584)//重复子类警告diss
18803 #pragma warning(disable:4250)//域控制继承警告diss
18804 #pragma warning(disable:26432)//不完全默认方法警告diss
18805 #pragma warning(disable:26435)//virtual override方法警告diss
18806 #pragma warning(disable:26481)//容器安利diss
18807 #pragma warning(disable:26446)//gsl::at安利diss
18808 #pragma warning(disable:26434)//方法覆盖警告diss
18809 #pragma warning(disable:26429)//gsl::not_null安利diss
18810 #pragma warning(disable:26471)//对void*进行static_cast安利diss
18811 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
18812 #pragma warning(disable:26473)//相同指针显式cast警告diss
18813 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
18814 #pragma warning(disable:26485)//数组作指针警告diss
18815 #pragma warning(disable:26490)//reinterpret_cast警告diss
18816 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
18817 #pragma warning(disable:26482)//非常数数组索引警告diss
18818 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
18819 #endif
18820 #if defined(_MSC_VER)
18821 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
18822 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
18823 #define push_msvc_warning() __pragma(warning(push))
18824 #define pop_msvc_warning() __pragma(warning(pop))
18825 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
18826 #else
18827 #define suppress_msvc_warning(...)
18828 #define disable_msvc_warning(...)
18829 #define push_msvc_warning()
18830 #define pop_msvc_warning()
18831 #define push_and_disable_msvc_warning(...)
18832 #endif
18833 //
18834 #if defined(ELC_VOID_NAME)
18835 #undef void
18836 #endif
18837
18838 // #define often_noexcept
18839 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
18840 #define noexcept_as_auto MAGIC//哦现在有了
18841 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
18842 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
18843
18844 #define using_method_from_base_t(name,...) \
18845 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
18846 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
18847 {\
18848 return base_t::name(forward<Args>(rest)...);\
18849 }\
18850
18851 #define using_method_from_value(name,value_name,...) \
18852 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
18853 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
18854 {\
18855 return value_name.name(forward<Args>(rest)...);\
18856 }\
18857
18858 #define floop while(__builtin_is_my_dick_still_there())
18859 #define enable_adl(name) void name()noexcept=delete
18860
18861 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
18862 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
18863
18864 #define declvalue(...) (::std::declval<__VA_ARGS__>())
18865
18866 /*实例化到此将引发错误*/
18867 #define template_error(reason) static_assert(template_error_helper<T>,reason)
18868 /*实例化到此将引发警告*/
18869 #define template_warning(reason) template_warning_helper<T>(reason)
18870
18871 //for type_info
18872 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
18873 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
18874
18875 #define is_common_attribute(name) public attribute<T,name<T>>
18876 #define is_special_attribute(name) public attribute<T,name>
18877
18878 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
18879 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
18880
18881 //for float_size_t
18882 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
18883 //bitnum_of
18884 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
18885
18886 //for attribute
18887 #define def_common_attribute_with_nothing(name) \
18888 template<typename T>\
18889 class name{}\
18890
18891 #define def_special_attribute_with_nothing(name) \
18892 class name{}\
18893
18894 #define common_attribute_t template<class>class
18895 #define special_attribute_t class
18896
18897 /*
18898 若参数的布尔值为零,那么此模板不会实例化
18899
18900 为什么不用cpp20的constraints?
18901 1.不能类内定义
18902 2.不能作为模板参数
18903 一句话总结:c艹标准会sb
18904 */
18905 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
18906 /*默认参与模板候选*/
18907 #define enabled_by_default class enable_state=void
18908 /*默认不参与模板候选*/
18909 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
18910 /*若参数为病式,那么此模板不会实例化*/
18911 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
18912 /*用于模板声明*/
18913 #define enable_flag class enable_state
18914
18915 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
18916 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
18917 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
18918 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
18919 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
18920
18921 /*让lambda递归更加美观*/
18922 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
18923 /*让lambda递归更加美观*/
18924 #define get_recursive_lambda_caller(name) \
18925 lambda_with_catch(&)(auto&&...Args){\
18926 return name(name,Args...);\
18927 }
18928 /*让lambda定义更加美观*/
18929 #define lambda []
18930 /*让lambda定义更加美观*/
18931 #define lambda_with_catch(...) [__VA_ARGS__]
18932 /*让lambda递归更加美观*/
18933 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
18934 //recursive_lambda_self_referential_reserved_symbolname
18935 #define lambda_RLSRRS _my_jb_super_sb_name_
18936
18937 #define MAGIC//ahh,ko no tenno da!
18938
18939 /*装饰性语法糖*/
18940 #define nothing
18941
18942 /*aya风格语法糖*/
18943 #define elseif else if
18944 /*aya风格语法糖*/
18945 #define _big_than_ >
18946 /*aya风格语法糖*/
18947 #define _small_than_ <
18948
18949 #if defined(_MSC_VER)
18950 #define not !
18951 #define and &&
18952 #define or ||
18953 #endif
18954
18955 /*进入名称空间,并不是很美观*/
18956 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
18957 /*退出名称空间,并不是很美观*/
18958 #define BREAK_NAMESPACE }
18959
18960 /*template说明符*/
18961 #define template_name template
18962 /*template说明符*/
18963 #define type_name class
18964
18965 #if defined(DEBUG) || defined(_DEBUG)
18966 #define not_in_debug 0
18967 #else
18968 #define not_in_debug 1
18969 #endif
18970
18971 #define es U""
18972 #define ec(ch) U ## ch
18973
18974 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
18975 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
18976 #else
18977 #define ELC_TEST_EVENTNAME(name)
18978 #endif
18979
18980 #define override_instance_struct \
18981 protected:\
18982 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
18983 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
18984 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
18985 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
18986 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
18987
18988 #if defined(_WIN32)
18989 #define distinctive __declspec(dllexport)
18990 #else
18991 #define distinctive
18992 #endif
18993
18994 #if defined(_WIN32)
18995 #define force_inline __forceinline
18996 #elif defined(__GNUC__)
18997 #define force_inline __attribute__((always_inline)) inline
18998 #else
18999 #define force_inline inline
19000 #endif
19001
19002 #if defined(_WIN32)
19003 #define with_no_vtable __declspec(novtable)
19004 #else
19005 #define with_no_vtable
19006 #endif
19007
19008 #define in_consteval (::std::is_constant_evaluated())
19009
19010 #define no_vtable_struct struct with_no_vtable
19011 #define no_vtable_class class with_no_vtable
19012
19013 //file_end
19014
19015 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19016
19017 //file_end
19018
19019 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19020
19021 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/literal.hpp"
19022 //literal.hpp
19023 //at namespace elc::defs
19024 /*
19025 未完成的elc解释器string文件
19026 由steve02081504与Alex0125设计、编写
19027 转载时请在不对此文件做任何修改的同时注明出处
19028 项目地址:https://github.com/steve02081504/ELC
19029 */
19030 namespace string_n{
19031 template<constexpr_str_n::constexpr_str_t_literal_helper str_helper>
19032 inline constexpr string operator""_elc_string()noexcept{
19033 return string(constexpr_str_n::operator""_constexpr_str<str_helper>());
19034 }
19035 }
19036 using string_n::operator""_elc_string;
19037
19038 //file_end
19039
19040 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19041
19042 #if defined(ELC_TEST_ON)
19043 namespace string_part_test{
19044 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_test.hpp"
19045 //_test.hpp
19046 /*
19047 未完成的elc解释器string文件
19048 由steve02081504与Alex0125设计、编写
19049 转载时请在不对此文件做任何修改的同时注明出处
19050 项目地址:https://github.com/steve02081504/ELC
19051 */
19052 inline void test(){
19053 ELC_TEST_EVENTNAME("string部分测试");
19054 {
19055 {
19056 string_t a=es"";
19057 stest_accert(a.size()==0);
19058 a=es"asd";
19059 stest_accert(a.size()==3);
19060 a=es"asd"+a;
19061 stest_accert(a.size()==6);
19062 a+=es"asd";
19063 stest_accert(es"asd"+a==es"asdasdasdasd");
19064 a[1]=ec('e');
19065 stest_accert(a.substr(0,3)==es"aed");
19066 stest_accert(a.substr(3).size()==6);
19067 stest_accert(a[2]==ec('d'));
19068 a.clear();
19069 stest_accert(a.size()==0);
19070 a.resize(3,ec('d'));
19071 stest_accert(a==es"ddd");
19072 for(const char_t&c:a)
19073 stest_accert(c==ec('d'));
19074 a=es"abc";
19075 stest_accert(a.begin()==a.cbegin());
19076 stest_accert(*a.begin()==ec('a'));
19077 stest_accert(a.begin()<=a.cend());
19078 stest_accert(*a.rbegin()==ec('c'));
19079 stest_accert(a.rbegin()<=a.rend());
19080 stest_accert(a.rbegin()==a.end()-1);
19081 a.push_back(es"as");
19082 a.push_front(ec('p'));
19083 stest_accert(a == es"pabcas");
19084 a.erase(1,3);
19085 a.erase(1);
19086 stest_accert(a == es"ps");
19087 stest_accert(a.pop_front() == ec('p'));
19088 stest_accert(a.pop_back() == ec('s'));
19089 stest_accert(a.size() == 0);
19090 a=es"abc";
19091 stest_accert(a.pop_back(2) == es"bc");
19092 stest_accert(a.size() == 1);
19093 a.push_front(es"wqer");
19094 stest_accert(a==es"wqera");
19095 a.insert(2,es"123");
19096 a.insert(0,es"123");
19097 a.insert(a.size(),es"123");
19098 stest_accert(a[2] == ec('3'));
19099 a[5]=ec('6');
19100 a[6]=ec('6');
19101 a[7]=ec('6');
19102 a[8]=ec('6');
19103 stest_accert(a == es"123wq6666ra123");
19104 for(char_t& c: a.view())
19105 c ='7';
19106 stest_accert(a == es"77777777777777");
19107 }
19108 {
19109 using namespace elc;
19110 using elc::defs::hash;
19111 auto a = es"ab"_elc_string;//constexpr_string_data_t
19112 stest_accert(hash(a) == hash(string_view(es"ab")));
19113 string b = es"ab";//comn_string_data_t
19114 stest_accert(hash(b) == hash(string_view(es"ab")));
19115 stest_accert(b.memory_cost() > a.memory_cost());
19116 a += b;//sum_string_data_t -> constexpr_string_data_t
19117 // -> comn_string_data_t
19118 stest_accert(hash(a) == hash(string_view(es"abab")));
19119 a.insert(1, 'c');//inserted_string_data_t -> sum_string_data_t
19120 stest_accert(hash(a) == hash(string_view(es"acbab")));
19121 a.erase(2, 3);//erased_string_data_t -> inserted_string_data_t
19122 stest_accert(hash(a) == hash(string_view(es"ac")));
19123 a.push_back(es"123");//end_apply_string_data_t -> erased_string_data_t
19124 stest_accert(hash(a) == hash(string_view(es"ac123")));
19125 a.push_front(es"123");//head_apply_string_data_t -> end_apply_string_data_t
19126 stest_accert(hash(a) == hash(string_view(es"123ac123")));
19127 }
19128 }
19129 check_memory_lack();
19130 }
19131 inline void test_log_out(){
19132 }
19133 inline void test_end(){
19134 }
19135
19136 //file_end
19137
19138 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19139 }
19140 #endif
19141
19142 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19143 //_undefs.hpp
19144 /*
19145 未完成的elc解释器basic文件
19146 由steve02081504与Alex0125设计、编写
19147 转载时请在不对此文件做任何修改的同时注明出处
19148 项目地址:https://github.com/steve02081504/ELC
19149 */
19150 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
19151 //_undefs.hpp
19152 /*
19153 未完成的elc解释器_share文件
19154 由steve02081504与Alex0125设计、编写
19155 转载时请在不对此文件做任何修改的同时注明出处
19156 项目地址:https://github.com/steve02081504/ELC
19157 */
19158
19159 //defs at "_defs.hpp"
19160
19161 #if defined(_MSC_VER)
19162 #pragma warning(pop)
19163 #endif
19164 #undef suppress_msvc_warning
19165 #undef disable_msvc_warning
19166 #undef push_msvc_warning
19167 #undef pop_msvc_warning
19168 #undef push_and_disable_msvc_warning
19169
19170 //for basic_environment.hpp
19171 #undef BIT_POSSIBILITY
19172 //
19173 #if defined(ELC_VOID_NAME)
19174 #define void the_void
19175 #endif
19176
19177 // #undef often_noexcept
19178 #undef noexcept_as
19179 #undef noexcept_as_auto
19180 #undef constexpr_as
19181 #undef constexpr_as_auto
19182
19183 #undef using_method_from_base_t
19184 #undef using_method_from_value
19185
19186 #undef floop
19187 #undef enable_adl
19188
19189 #undef re_declvalue
19190 #undef re_decltype
19191
19192 #undef declvalue
19193
19194 #undef template_error
19195 #undef template_warning
19196
19197 #undef type_info_of
19198 #undef type_name_of
19199
19200 #undef is_common_attribute
19201 #undef is_special_attribute
19202
19203 #undef has_attribute
19204 #undef not_has_attribute
19205
19206 #undef float_size_of
19207 #undef bitnum_of
19208
19209 #undef def_common_attribute_with_nothing
19210 #undef def_special_attribute_with_nothing
19211
19212 #undef common_attribute_t
19213 #undef special_attribute_t
19214
19215 #undef enable_if
19216 #undef enabled_by_default
19217 #undef disabled_by_default
19218 #undef enable_if_not_ill_form
19219 #undef enable_flag
19220
19221 #undef was_an_ill_form
19222 #undef was_an_ill_form_with_parameter
19223 #undef was_not_an_ill_form
19224 #undef was_not_an_ill_form_and_noexcept
19225 #undef was_not_an_ill_form_with_parameter
19226
19227 #undef recursive_lambda
19228 #undef get_recursive_lambda_caller
19229 #undef lambda
19230 #undef lambda_with_catch
19231 #undef self_recursion
19232 #undef lambda_RLSRRS
19233
19234 #undef MAGIC
19235
19236 #undef nothing
19237
19238 #undef elseif
19239 #undef _big_than_
19240 #undef _small_than_
19241
19242 #if defined(_MSC_VER)
19243 #undef not
19244 #undef and
19245 #undef or
19246 #endif
19247
19248 #undef INTER_NAMESPACE
19249 #undef BREAK_NAMESPACE
19250
19251 #undef szie
19252 #undef form
19253
19254 #undef template_name
19255 #undef type_name
19256
19257 #undef not_in_debug
19258
19259 #undef es
19260 #undef ec
19261
19262 #undef ELC_TEST_EVENTNAME
19263
19264 #undef override_instance_struct
19265
19266 #undef distinctive
19267
19268 #undef force_inline
19269
19270 #undef with_no_vtable
19271
19272 #undef in_consteval
19273
19274 #undef no_vtable_struct
19275 #undef no_vtable_class
19276
19277 //file_end
19278
19279 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19280
19281 //file_end
19282
19283 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19284 }
19285 namespace elc{
19286 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_export.hpp"
19287 //_export.hpp
19288 //at namespace elc
19289 /*
19290 未完成的elc解释器string文件
19291 由steve02081504与Alex0125设计、编写
19292 转载时请在不对此文件做任何修改的同时注明出处
19293 项目地址:https://github.com/steve02081504/ELC
19294 */
19295 #define export using defs::
19297 export string;
19298 export string_view_t;
19300 export operator""_elc_string;
19301 export operator""_constexpr_str;
19302 #undef export
19303
19304 //file_end
19305
19306 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19307 }
19308 #if defined(ELC_CORE)
19309 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
19310 //string_arec_as_value.hpp
19311 //at namespace ::
19312 //multi when ELC_STRING & ELC_CORE
19313 /*
19314 未完成的elc解释器string文件
19315 由steve02081504与Alex0125设计、编写
19316 转载时请在不对此文件做任何修改的同时注明出处
19317 项目地址:https://github.com/steve02081504/ELC
19318 */
19319 namespace elc::defs{
19320 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19321 //_defs.hpp
19322 /*
19323 未完成的elc解释器basic文件
19324 由steve02081504与Alex0125设计、编写
19325 转载时请在不对此文件做任何修改的同时注明出处
19326 项目地址:https://github.com/steve02081504/ELC
19327 */
19328 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19329 //_defs.hpp
19330 /*
19331 未完成的elc解释器_share文件
19332 由steve02081504与Alex0125设计、编写
19333 转载时请在不对此文件做任何修改的同时注明出处
19334 项目地址:https://github.com/steve02081504/ELC
19335 */
19336
19337 //undefs at "_undefs.hpp"
19338
19339 //set ELC_WARNING_LEVEL default to 4(max)
19340 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19341
19342 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
19343 //basic_environment.hpp
19344 /*
19345 未完成的elc解释器_share文件
19346 由steve02081504与Alex0125设计、编写
19347 转载时请在不对此文件做任何修改的同时注明出处
19348 项目地址:https://github.com/steve02081504/ELC
19349 */
19350
19351 //每个bit(不是字节)的可能性
19352 //为什么c艹委员会不定义这个?
19353 #define BIT_POSSIBILITY 2
19354
19355 //file_end
19356
19357 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19358
19359 #if defined(_MSC_VER)
19360 #pragma warning(push,ELC_WARNING_LEVEL)
19361 #pragma warning(disable:4099)//class与struct混用警告diss
19362 #pragma warning(disable:26812)//enum class安利diss.
19363 #pragma warning(disable:4584)//重复子类警告diss
19364 #pragma warning(disable:4250)//域控制继承警告diss
19365 #pragma warning(disable:26432)//不完全默认方法警告diss
19366 #pragma warning(disable:26435)//virtual override方法警告diss
19367 #pragma warning(disable:26481)//容器安利diss
19368 #pragma warning(disable:26446)//gsl::at安利diss
19369 #pragma warning(disable:26434)//方法覆盖警告diss
19370 #pragma warning(disable:26429)//gsl::not_null安利diss
19371 #pragma warning(disable:26471)//对void*进行static_cast安利diss
19372 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
19373 #pragma warning(disable:26473)//相同指针显式cast警告diss
19374 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
19375 #pragma warning(disable:26485)//数组作指针警告diss
19376 #pragma warning(disable:26490)//reinterpret_cast警告diss
19377 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
19378 #pragma warning(disable:26482)//非常数数组索引警告diss
19379 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
19380 #endif
19381 #if defined(_MSC_VER)
19382 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
19383 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
19384 #define push_msvc_warning() __pragma(warning(push))
19385 #define pop_msvc_warning() __pragma(warning(pop))
19386 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
19387 #else
19388 #define suppress_msvc_warning(...)
19389 #define disable_msvc_warning(...)
19390 #define push_msvc_warning()
19391 #define pop_msvc_warning()
19392 #define push_and_disable_msvc_warning(...)
19393 #endif
19394 //
19395 #if defined(ELC_VOID_NAME)
19396 #undef void
19397 #endif
19398
19399 // #define often_noexcept
19400 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
19401 #define noexcept_as_auto MAGIC//哦现在有了
19402 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
19403 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
19404
19405 #define using_method_from_base_t(name,...) \
19406 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
19407 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
19408 {\
19409 return base_t::name(forward<Args>(rest)...);\
19410 }\
19411
19412 #define using_method_from_value(name,value_name,...) \
19413 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
19414 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
19415 {\
19416 return value_name.name(forward<Args>(rest)...);\
19417 }\
19418
19419 #define floop while(__builtin_is_my_dick_still_there())
19420 #define enable_adl(name) void name()noexcept=delete
19421
19422 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
19423 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
19424
19425 #define declvalue(...) (::std::declval<__VA_ARGS__>())
19426
19427 /*实例化到此将引发错误*/
19428 #define template_error(reason) static_assert(template_error_helper<T>,reason)
19429 /*实例化到此将引发警告*/
19430 #define template_warning(reason) template_warning_helper<T>(reason)
19431
19432 //for type_info
19433 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
19434 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
19435
19436 #define is_common_attribute(name) public attribute<T,name<T>>
19437 #define is_special_attribute(name) public attribute<T,name>
19438
19439 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
19440 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
19441
19442 //for float_size_t
19443 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
19444 //bitnum_of
19445 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
19446
19447 //for attribute
19448 #define def_common_attribute_with_nothing(name) \
19449 template<typename T>\
19450 class name{}\
19451
19452 #define def_special_attribute_with_nothing(name) \
19453 class name{}\
19454
19455 #define common_attribute_t template<class>class
19456 #define special_attribute_t class
19457
19458 /*
19459 若参数的布尔值为零,那么此模板不会实例化
19460
19461 为什么不用cpp20的constraints?
19462 1.不能类内定义
19463 2.不能作为模板参数
19464 一句话总结:c艹标准会sb
19465 */
19466 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
19467 /*默认参与模板候选*/
19468 #define enabled_by_default class enable_state=void
19469 /*默认不参与模板候选*/
19470 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
19471 /*若参数为病式,那么此模板不会实例化*/
19472 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
19473 /*用于模板声明*/
19474 #define enable_flag class enable_state
19475
19476 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
19477 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
19478 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
19479 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
19480 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
19481
19482 /*让lambda递归更加美观*/
19483 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
19484 /*让lambda递归更加美观*/
19485 #define get_recursive_lambda_caller(name) \
19486 lambda_with_catch(&)(auto&&...Args){\
19487 return name(name,Args...);\
19488 }
19489 /*让lambda定义更加美观*/
19490 #define lambda []
19491 /*让lambda定义更加美观*/
19492 #define lambda_with_catch(...) [__VA_ARGS__]
19493 /*让lambda递归更加美观*/
19494 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
19495 //recursive_lambda_self_referential_reserved_symbolname
19496 #define lambda_RLSRRS _my_jb_super_sb_name_
19497
19498 #define MAGIC//ahh,ko no tenno da!
19499
19500 /*装饰性语法糖*/
19501 #define nothing
19502
19503 /*aya风格语法糖*/
19504 #define elseif else if
19505 /*aya风格语法糖*/
19506 #define _big_than_ >
19507 /*aya风格语法糖*/
19508 #define _small_than_ <
19509
19510 #if defined(_MSC_VER)
19511 #define not !
19512 #define and &&
19513 #define or ||
19514 #endif
19515
19516 /*进入名称空间,并不是很美观*/
19517 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
19518 /*退出名称空间,并不是很美观*/
19519 #define BREAK_NAMESPACE }
19520
19521 /*template说明符*/
19522 #define template_name template
19523 /*template说明符*/
19524 #define type_name class
19525
19526 #if defined(DEBUG) || defined(_DEBUG)
19527 #define not_in_debug 0
19528 #else
19529 #define not_in_debug 1
19530 #endif
19531
19532 #define es U""
19533 #define ec(ch) U ## ch
19534
19535 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
19536 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
19537 #else
19538 #define ELC_TEST_EVENTNAME(name)
19539 #endif
19540
19541 #define override_instance_struct \
19542 protected:\
19543 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
19544 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
19545 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
19546 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
19547 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
19548
19549 #if defined(_WIN32)
19550 #define distinctive __declspec(dllexport)
19551 #else
19552 #define distinctive
19553 #endif
19554
19555 #if defined(_WIN32)
19556 #define force_inline __forceinline
19557 #elif defined(__GNUC__)
19558 #define force_inline __attribute__((always_inline)) inline
19559 #else
19560 #define force_inline inline
19561 #endif
19562
19563 #if defined(_WIN32)
19564 #define with_no_vtable __declspec(novtable)
19565 #else
19566 #define with_no_vtable
19567 #endif
19568
19569 #define in_consteval (::std::is_constant_evaluated())
19570
19571 #define no_vtable_struct struct with_no_vtable
19572 #define no_vtable_class class with_no_vtable
19573
19574 //file_end
19575
19576 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19577
19578 //file_end
19579
19580 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
19581
19582 namespace string_n{
19583 template<class char_T>
19584 value arec_as_value(string_t<char_T>&str,const value index){
19585 size_t i=size_t(use_as<int_t>(index));
19586 if(!i)
19587 i=size_t(use_as<uint_t>(index));
19588 struct arec_data_t final:instance_struct<arec_data_t>
19589 ,value::base_data_t{
19591 arec_data_t(string_t<char_T>&str,size_t index)noexcept:_m(&str,index){};
19592 arec_data_t(const arec_data_t&ref)noexcept:_m(special_init,ref._m){}
19593 virtual ~arec_data_t()noexcept override final=default;
19594
19595 virtual void be_set(ptr a)noexcept override final{move(_m)=use_as<char_T>(a);}
19596 [[nodiscard]]virtual ptr get_value()noexcept override final{return core::make_binary_node_from<char_T>(move(_m));}
19597 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<arec_data_t>(*this);}
19598 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<arec_data_t>;}
19599 };
19600 return get<arec_data_t>(str,i);
19601 }
19602 }
19603
19604 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19605 //_undefs.hpp
19606 /*
19607 未完成的elc解释器basic文件
19608 由steve02081504与Alex0125设计、编写
19609 转载时请在不对此文件做任何修改的同时注明出处
19610 项目地址:https://github.com/steve02081504/ELC
19611 */
19612 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
19613 //_undefs.hpp
19614 /*
19615 未完成的elc解释器_share文件
19616 由steve02081504与Alex0125设计、编写
19617 转载时请在不对此文件做任何修改的同时注明出处
19618 项目地址:https://github.com/steve02081504/ELC
19619 */
19620
19621 //defs at "_defs.hpp"
19622
19623 #if defined(_MSC_VER)
19624 #pragma warning(pop)
19625 #endif
19626 #undef suppress_msvc_warning
19627 #undef disable_msvc_warning
19628 #undef push_msvc_warning
19629 #undef pop_msvc_warning
19630 #undef push_and_disable_msvc_warning
19631
19632 //for basic_environment.hpp
19633 #undef BIT_POSSIBILITY
19634 //
19635 #if defined(ELC_VOID_NAME)
19636 #define void the_void
19637 #endif
19638
19639 // #undef often_noexcept
19640 #undef noexcept_as
19641 #undef noexcept_as_auto
19642 #undef constexpr_as
19643 #undef constexpr_as_auto
19644
19645 #undef using_method_from_base_t
19646 #undef using_method_from_value
19647
19648 #undef floop
19649 #undef enable_adl
19650
19651 #undef re_declvalue
19652 #undef re_decltype
19653
19654 #undef declvalue
19655
19656 #undef template_error
19657 #undef template_warning
19658
19659 #undef type_info_of
19660 #undef type_name_of
19661
19662 #undef is_common_attribute
19663 #undef is_special_attribute
19664
19665 #undef has_attribute
19666 #undef not_has_attribute
19667
19668 #undef float_size_of
19669 #undef bitnum_of
19670
19671 #undef def_common_attribute_with_nothing
19672 #undef def_special_attribute_with_nothing
19673
19674 #undef common_attribute_t
19675 #undef special_attribute_t
19676
19677 #undef enable_if
19678 #undef enabled_by_default
19679 #undef disabled_by_default
19680 #undef enable_if_not_ill_form
19681 #undef enable_flag
19682
19683 #undef was_an_ill_form
19684 #undef was_an_ill_form_with_parameter
19685 #undef was_not_an_ill_form
19686 #undef was_not_an_ill_form_and_noexcept
19687 #undef was_not_an_ill_form_with_parameter
19688
19689 #undef recursive_lambda
19690 #undef get_recursive_lambda_caller
19691 #undef lambda
19692 #undef lambda_with_catch
19693 #undef self_recursion
19694 #undef lambda_RLSRRS
19695
19696 #undef MAGIC
19697
19698 #undef nothing
19699
19700 #undef elseif
19701 #undef _big_than_
19702 #undef _small_than_
19703
19704 #if defined(_MSC_VER)
19705 #undef not
19706 #undef and
19707 #undef or
19708 #endif
19709
19710 #undef INTER_NAMESPACE
19711 #undef BREAK_NAMESPACE
19712
19713 #undef szie
19714 #undef form
19715
19716 #undef template_name
19717 #undef type_name
19718
19719 #undef not_in_debug
19720
19721 #undef es
19722 #undef ec
19723
19724 #undef ELC_TEST_EVENTNAME
19725
19726 #undef override_instance_struct
19727
19728 #undef distinctive
19729
19730 #undef force_inline
19731
19732 #undef with_no_vtable
19733
19734 #undef in_consteval
19735
19736 #undef no_vtable_struct
19737 #undef no_vtable_class
19738
19739 //file_end
19740
19741 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19742
19743 //file_end
19744
19745 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
19746 }
19747
19748 //file_end
19749
19750 #line 37 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19751 #endif
19752
19753 //file_end
19754
19755 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19756 #endif
19757
19758 //file_end
19759
19760 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
19761 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
19762 //_body.hpp
19763 //at namespace ::
19764 /*
19765 未完成的elc解释器template文件
19766 由steve02081504与Alex0125设计、编写
19767 转载时请在不对此文件做任何修改的同时注明出处
19768 项目地址:https://github.com/steve02081504/ELC
19769 */
19770 #if defined(ELC_TEST)
19771 #error "this part cannot be tested."
19772 #endif
19773 //include APIs:elc中可能根据编译环境而修改的底层函数
19774 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
19775 //str_code_convert.hpp
19776 /*
19777 未完成的elc解释器_share文件
19778 由steve02081504与Alex0125设计、编写
19779 转载时请在不对此文件做任何修改的同时注明出处
19780 项目地址:https://github.com/steve02081504/ELC
19781 */
19782 /*
19783 APIs说明
19784 elc依赖的基础函数.
19785 调整这些,实现快速移植,快速优化与行为自定义.
19786 */
19787 #line 70 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
19788
19789 //file_end
19790
19791 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
19792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
19793 //library_load.hpp
19794 /*
19795 未完成的elc解释器_share文件
19796 由steve02081504与Alex0125设计、编写
19797 转载时请在不对此文件做任何修改的同时注明出处
19798 项目地址:https://github.com/steve02081504/ELC
19799 */
19800 /*
19801 APIs说明
19802 elc依赖的基础函数.
19803 调整这些,实现快速移植,快速优化与行为自定义.
19804 */
19805 #if !defined(ELC_APIS_library_load)
19806 #define ELC_APIS_library_load
19807 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/decl_system_type.hpp"
19808 //decl_system_type.hpp
19809 /*
19810 未完成的elc解释器_share文件
19811 由steve02081504与Alex0125设计、编写
19812 转载时请在不对此文件做任何修改的同时注明出处
19813 项目地址:https://github.com/steve02081504/ELC
19814 */
19815 //copy&rewrite from steve02081504/steve.h
19816 #define linux 2
19817 #define windows 3
19818 #define other 4
19819 #if defined(__linux)||defined(__linux__)||defined(__gnu_linux__)
19820 #define SYSTEM_TYPE linux
19821 #elif defined(_WIN32)||defined(__MINGW32__)||defined(__CYGWIN__)
19822 #define SYSTEM_TYPE windows
19823 #else
19824 #define SYSTEM_TYPE other
19825 #endif
19826 #define ERROR_MSG_UNABLE_OS "Unable OS,edit this file on your own or contact ELC's producers."
19827
19828 //file_end
19829
19830 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
19831 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19832 //string
19833 //at namespace ::
19834 /*
19835 未完成的elc解释器include文件
19836 由steve02081504与Alex0125设计、编写
19837 转载时请在不对此文件做任何修改的同时注明出处
19838 项目地址:https://github.com/steve02081504/ELC
19839 */
19840 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19841
19842 //file_end
19843
19844 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
19845 #if SYSTEM_TYPE == linux
19846 #include <dlfcn.h>
19847 #elif SYSTEM_TYPE == windows
19848 #define NOMINMAX
19849 #include <Windows.h>
19850 #include <Libloaderapi.h>
19851 #include <Errhandlingapi.h>//GetLastError
19852 //to_string
19853 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
19854 //numerical_representation
19855 //at namespace ::
19856 /*
19857 未完成的elc解释器include文件
19858 由steve02081504与Alex0125设计、编写
19859 转载时请在不对此文件做任何修改的同时注明出处
19860 项目地址:https://github.com/steve02081504/ELC
19861 */
19862 #if !defined(ELC_NUMERICAL_REPRESENTATION)
19863 #define ELC_NUMERICAL_REPRESENTATION
19864 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19865 //string
19866 //at namespace ::
19867 /*
19868 未完成的elc解释器include文件
19869 由steve02081504与Alex0125设计、编写
19870 转载时请在不对此文件做任何修改的同时注明出处
19871 项目地址:https://github.com/steve02081504/ELC
19872 */
19873 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19874
19875 //file_end
19876
19877 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
19878 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
19879 //_body.hpp
19880 //at namespace ::
19881 /*
19882 未完成的elc解释器numerical_representation文件
19883 由steve02081504与Alex0125设计、编写
19884 转载时请在不对此文件做任何修改的同时注明出处
19885 项目地址:https://github.com/steve02081504/ELC
19886 */
19887 #if defined(ELC_TEST)
19888 #error "this part cannot be tested."
19889 #endif
19890 namespace elc::defs{
19891 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19892 //_defs.hpp
19893 /*
19894 未完成的elc解释器basic文件
19895 由steve02081504与Alex0125设计、编写
19896 转载时请在不对此文件做任何修改的同时注明出处
19897 项目地址:https://github.com/steve02081504/ELC
19898 */
19899 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19900 //_defs.hpp
19901 /*
19902 未完成的elc解释器_share文件
19903 由steve02081504与Alex0125设计、编写
19904 转载时请在不对此文件做任何修改的同时注明出处
19905 项目地址:https://github.com/steve02081504/ELC
19906 */
19907
19908 //undefs at "_undefs.hpp"
19909
19910 //set ELC_WARNING_LEVEL default to 4(max)
19911 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19912
19913 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
19914 //basic_environment.hpp
19915 /*
19916 未完成的elc解释器_share文件
19917 由steve02081504与Alex0125设计、编写
19918 转载时请在不对此文件做任何修改的同时注明出处
19919 项目地址:https://github.com/steve02081504/ELC
19920 */
19921
19922 //每个bit(不是字节)的可能性
19923 //为什么c艹委员会不定义这个?
19924 #define BIT_POSSIBILITY 2
19925
19926 //file_end
19927
19928 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19929
19930 #if defined(_MSC_VER)
19931 #pragma warning(push,ELC_WARNING_LEVEL)
19932 #pragma warning(disable:4099)//class与struct混用警告diss
19933 #pragma warning(disable:26812)//enum class安利diss.
19934 #pragma warning(disable:4584)//重复子类警告diss
19935 #pragma warning(disable:4250)//域控制继承警告diss
19936 #pragma warning(disable:26432)//不完全默认方法警告diss
19937 #pragma warning(disable:26435)//virtual override方法警告diss
19938 #pragma warning(disable:26481)//容器安利diss
19939 #pragma warning(disable:26446)//gsl::at安利diss
19940 #pragma warning(disable:26434)//方法覆盖警告diss
19941 #pragma warning(disable:26429)//gsl::not_null安利diss
19942 #pragma warning(disable:26471)//对void*进行static_cast安利diss
19943 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
19944 #pragma warning(disable:26473)//相同指针显式cast警告diss
19945 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
19946 #pragma warning(disable:26485)//数组作指针警告diss
19947 #pragma warning(disable:26490)//reinterpret_cast警告diss
19948 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
19949 #pragma warning(disable:26482)//非常数数组索引警告diss
19950 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
19951 #endif
19952 #if defined(_MSC_VER)
19953 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
19954 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
19955 #define push_msvc_warning() __pragma(warning(push))
19956 #define pop_msvc_warning() __pragma(warning(pop))
19957 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
19958 #else
19959 #define suppress_msvc_warning(...)
19960 #define disable_msvc_warning(...)
19961 #define push_msvc_warning()
19962 #define pop_msvc_warning()
19963 #define push_and_disable_msvc_warning(...)
19964 #endif
19965 //
19966 #if defined(ELC_VOID_NAME)
19967 #undef void
19968 #endif
19969
19970 // #define often_noexcept
19971 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
19972 #define noexcept_as_auto MAGIC//哦现在有了
19973 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
19974 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
19975
19976 #define using_method_from_base_t(name,...) \
19977 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
19978 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
19979 {\
19980 return base_t::name(forward<Args>(rest)...);\
19981 }\
19982
19983 #define using_method_from_value(name,value_name,...) \
19984 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
19985 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
19986 {\
19987 return value_name.name(forward<Args>(rest)...);\
19988 }\
19989
19990 #define floop while(__builtin_is_my_dick_still_there())
19991 #define enable_adl(name) void name()noexcept=delete
19992
19993 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
19994 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
19995
19996 #define declvalue(...) (::std::declval<__VA_ARGS__>())
19997
19998 /*实例化到此将引发错误*/
19999 #define template_error(reason) static_assert(template_error_helper<T>,reason)
20000 /*实例化到此将引发警告*/
20001 #define template_warning(reason) template_warning_helper<T>(reason)
20002
20003 //for type_info
20004 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
20005 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
20006
20007 #define is_common_attribute(name) public attribute<T,name<T>>
20008 #define is_special_attribute(name) public attribute<T,name>
20009
20010 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
20011 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
20012
20013 //for float_size_t
20014 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
20015 //bitnum_of
20016 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
20017
20018 //for attribute
20019 #define def_common_attribute_with_nothing(name) \
20020 template<typename T>\
20021 class name{}\
20022
20023 #define def_special_attribute_with_nothing(name) \
20024 class name{}\
20025
20026 #define common_attribute_t template<class>class
20027 #define special_attribute_t class
20028
20029 /*
20030 若参数的布尔值为零,那么此模板不会实例化
20031
20032 为什么不用cpp20的constraints?
20033 1.不能类内定义
20034 2.不能作为模板参数
20035 一句话总结:c艹标准会sb
20036 */
20037 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
20038 /*默认参与模板候选*/
20039 #define enabled_by_default class enable_state=void
20040 /*默认不参与模板候选*/
20041 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
20042 /*若参数为病式,那么此模板不会实例化*/
20043 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
20044 /*用于模板声明*/
20045 #define enable_flag class enable_state
20046
20047 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
20048 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
20049 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
20050 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
20051 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
20052
20053 /*让lambda递归更加美观*/
20054 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
20055 /*让lambda递归更加美观*/
20056 #define get_recursive_lambda_caller(name) \
20057 lambda_with_catch(&)(auto&&...Args){\
20058 return name(name,Args...);\
20059 }
20060 /*让lambda定义更加美观*/
20061 #define lambda []
20062 /*让lambda定义更加美观*/
20063 #define lambda_with_catch(...) [__VA_ARGS__]
20064 /*让lambda递归更加美观*/
20065 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
20066 //recursive_lambda_self_referential_reserved_symbolname
20067 #define lambda_RLSRRS _my_jb_super_sb_name_
20068
20069 #define MAGIC//ahh,ko no tenno da!
20070
20071 /*装饰性语法糖*/
20072 #define nothing
20073
20074 /*aya风格语法糖*/
20075 #define elseif else if
20076 /*aya风格语法糖*/
20077 #define _big_than_ >
20078 /*aya风格语法糖*/
20079 #define _small_than_ <
20080
20081 #if defined(_MSC_VER)
20082 #define not !
20083 #define and &&
20084 #define or ||
20085 #endif
20086
20087 /*进入名称空间,并不是很美观*/
20088 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
20089 /*退出名称空间,并不是很美观*/
20090 #define BREAK_NAMESPACE }
20091
20092 /*template说明符*/
20093 #define template_name template
20094 /*template说明符*/
20095 #define type_name class
20096
20097 #if defined(DEBUG) || defined(_DEBUG)
20098 #define not_in_debug 0
20099 #else
20100 #define not_in_debug 1
20101 #endif
20102
20103 #define es U""
20104 #define ec(ch) U ## ch
20105
20106 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
20107 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
20108 #else
20109 #define ELC_TEST_EVENTNAME(name)
20110 #endif
20111
20112 #define override_instance_struct \
20113 protected:\
20114 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
20115 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
20116 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
20117 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
20118 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
20119
20120 #if defined(_WIN32)
20121 #define distinctive __declspec(dllexport)
20122 #else
20123 #define distinctive
20124 #endif
20125
20126 #if defined(_WIN32)
20127 #define force_inline __forceinline
20128 #elif defined(__GNUC__)
20129 #define force_inline __attribute__((always_inline)) inline
20130 #else
20131 #define force_inline inline
20132 #endif
20133
20134 #if defined(_WIN32)
20135 #define with_no_vtable __declspec(novtable)
20136 #else
20137 #define with_no_vtable
20138 #endif
20139
20140 #define in_consteval (::std::is_constant_evaluated())
20141
20142 #define no_vtable_struct struct with_no_vtable
20143 #define no_vtable_class class with_no_vtable
20144
20145 //file_end
20146
20147 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
20148
20149 //file_end
20150
20151 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20152
20153 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/defs.hpp"
20154 //defs.hpp
20155 /*
20156 未完成的elc解释器numerical_representation文件
20157 由steve02081504与Alex0125设计、编写
20158 转载时请在不对此文件做任何修改的同时注明出处
20159 项目地址:https://github.com/steve02081504/ELC
20160 */
20161
20162 /*
20163 客制化to_string用途类
20164 */
20165 struct base_numerical_representation_t{};
20166 /*
20167 记录数字的表示方式以便客制化to_string
20168 */
20169 class numerical_representation_t:public base_numerical_representation_t{
20170 size_t _radix=10;
20171 string _radix_table=es"0123456789"_constexpr_str;
20172 char_t _fractional_sign=ec('.');
20173 char_t _positive_sign=ec('+');
20174 char_t _negative_sign=ec('-');
20175 string _nan=es"NaN"_constexpr_str;
20176 string _signaling_nan=es"signaling_NaN"_constexpr_str;
20177 string _quiet_nan=es"quiet_NaN"_constexpr_str;
20178 string _inf=es"Inf"_constexpr_str;
20179 char_t _unknown_data_start_sign=ec('[');
20180 char_t _unknown_data_split_sign=ec(',');
20181 char_t _unknown_data_end_sign=ec(']');
20182 public:
20183 numerical_representation_t()noexcept=default;
20184 numerical_representation_t(const numerical_representation_t&)noexcept=default;
20185 numerical_representation_t(numerical_representation_t&&)noexcept=default;
20186 numerical_representation_t(size_t radix,string radix_table,
20187 char_t fractional_sign,
20188 char_t positive_sign,char_t negative_sign,
20189 string nan,string signaling_nan,string quiet_nan,
20190 string inf,
20191 char_t unknown_data_start_sign,char_t unknown_data_split_sign,char_t unknown_data_end_sign
20192 )noexcept:
20193 _radix(radix),_radix_table(radix_table),
20194 _fractional_sign(fractional_sign),
20195 _positive_sign(positive_sign),_negative_sign(negative_sign),
20196 _nan(nan),_signaling_nan(signaling_nan),_quiet_nan(quiet_nan),
20197 _inf(inf),
20198 _unknown_data_start_sign(unknown_data_start_sign),_unknown_data_split_sign(unknown_data_split_sign),_unknown_data_end_sign(unknown_data_end_sign)
20199 {}
20200 numerical_representation_t(size_t radix,string radix_table)noexcept:
20201 _radix(radix),
20202 _radix_table(radix_table)
20203 {}
20204 public:
20205 void set_radix(size_t radix)noexcept{
20206 _radix=radix;
20207 }
20208 void set_radix_table(string radix_table)noexcept{
20209 _radix_table=radix_table;
20210 _radix=radix_table.size();
20211 }
20212 void set_fractional_sign(char_t point)noexcept{
20213 _fractional_sign=point;
20214 }
20215 void set_positive_sign(char_t positive_sign)noexcept{
20216 _positive_sign=positive_sign;
20217 }
20218 void set_negative_sign(char_t negative_sign)noexcept{
20219 _negative_sign=negative_sign;
20220 }
20221 void set_nan(string nan)noexcept{
20222 _nan=nan;
20223 }
20224 void set_inf(string inf)noexcept{
20225 _inf=inf;
20226 }
20227 [[nodiscard]]constexpr size_t radix()const noexcept{
20228 return _radix;
20229 }
20230 [[nodiscard]]string radix_table()const noexcept{
20231 return _radix_table;
20232 }
20233 [[nodiscard]]constexpr char_t fractional_sign()const noexcept{
20234 return _fractional_sign;
20235 }
20236 [[nodiscard]]constexpr char_t positive_sign()const noexcept{
20237 return _positive_sign;
20238 }
20239 [[nodiscard]]constexpr char_t negative_sign()const noexcept{
20240 return _negative_sign;
20241 }
20242 [[nodiscard]]string nan()const noexcept{
20243 return _nan;
20244 }
20245 [[nodiscard]]string inf()const noexcept{
20246 return _inf;
20247 }
20248 private:
20249 //信息尾部分
20250 inline size_t get_info_tail_size_per_byte()const noexcept{
20251 constexpr auto info_threshold_base = pow(BIT_POSSIBILITY, bitnum_of(byte));
20252 const auto info_threshold = to_size_t(ceil(log(info_threshold_base, _radix)));
20253 return info_threshold;
20254 }
20255 template<typename T>
20256 inline size_t get_info_tail_size()const noexcept{
20257 return get_info_tail_size_per_byte()*sizeof(T);
20258 }
20259 template<typename T>
20260 inline string get_info_tail(T x)const noexcept{
20261 auto info_tail_size_per_byte = get_info_tail_size_per_byte();
20262 string aret;
20263 data_view<const T> view{&x};
20264 for(const byte c: view){
20265 auto s= to_string_rough((unsigned char)c);
20266 aret+=string{info_tail_size_per_byte-s.size(),_radix_table[0]}+s;
20267 }
20268 return aret;
20269 }
20270 template<typename T>
20271 inline T get_from_info_tail(string str)const noexcept{
20272 const auto info_tail_size_per_byte = get_info_tail_size_per_byte();
20273 T aret{};
20274 data_view<T> view{&aret};
20275 for(byte&c: view){
20276 auto s=str.substr(0,info_tail_size_per_byte);
20277 c=(byte)from_string_get<unsigned char>(s);
20278 str=str.substr(info_tail_size_per_byte);
20279 }
20280 return aret;
20281 }
20282 template<typename T>
20283 inline string to_string_num_base(T num)const noexcept{
20284 if constexpr(::std::is_floating_point_v<T>){
20285 string aret;
20286 suppress_msvc_warning(26494)//未初始化警告diss
20287 size_t order_of_magnitude;
20288 if(num>1)
20289 order_of_magnitude = to_size_t(floor(log(num,_radix)+1));
20290 else {
20291 order_of_magnitude = 0;
20292 aret=_radix_table[0];
20293 aret+=_fractional_sign;
20294 }
20295 num/=pow(_radix,order_of_magnitude);
20296 if(num>=1){
20297 aret=_radix_table[to_size_t(num)];
20298 num=0;
20299 }
20300 //Information threshold相关声明
20301 //这限制了在当前radix下mantissa的最大长度,避免如radix=3而num=0.25时的无限循环
20302 constinit auto info_threshold_base = pow(BIT_POSSIBILITY,bitnum_of(T));
20303 auto info_threshold = to_size_t(ceil(log(info_threshold_base,_radix)));
20304 //浮点数精度浮动,所以需要确定何时开始使用Info threshold
20305 bool is_mantissa_begined = false;
20306 while(num){
20307 //mantissa push部分
20308 num*=_radix;
20309 T first_char_index;
20310 num=::std::modf(num,&first_char_index);
20311 aret+=_radix_table[to_size_t(first_char_index)];
20312 //Information threshold制御部分
20313 if(to_size_t(first_char_index))
20314 is_mantissa_begined = true;
20315 if(is_mantissa_begined){
20316 if(info_threshold)
20317 info_threshold--;
20318 }
20319 //小数点计数部分
20320 if(order_of_magnitude){
20321 if(!--order_of_magnitude)
20322 aret+=_fractional_sign;
20323 }
20324 //结束判断
20325 if(!info_threshold && !order_of_magnitude)
20326 break;
20327 }
20328 if(order_of_magnitude)
20329 aret.append(order_of_magnitude,_radix_table[0]);
20330 if(aret.ends_with(_fractional_sign))
20331 aret.pop_back();
20332 return aret;
20333 }
20334 else{
20335 string aret;
20336 do{//do while,在num为0时也有返值
20337 const auto first_char_index = mod(num,_radix);
20338 num /= (T)_radix;
20339 aret.push_front(_radix_table[(size_t)first_char_index]);
20340 }while(num>=T{1});
20341 return aret;
20342 }
20343 }
20344 template<typename T>
20345 inline bool to_string_special_value_check(T num,string&str,bool is_negative)const noexcept{
20346 if constexpr(::std::numeric_limits<T>::has_signaling_NaN || ::std::numeric_limits<T>::has_quiet_NaN){
20347 if(::std::isnan(num)){
20348 if constexpr(::std::numeric_limits<T>::has_signaling_NaN){
20349 constexpr auto signaling_NaN = ::std::numeric_limits<T>::signaling_NaN();
20350 if(full_equal_in_byte(signaling_NaN,num)){
20351 str=_signaling_nan;
20352 return true;
20353 }
20354 auto negative_signaling_NaN = copy_as_negative(signaling_NaN);
20355 if(full_equal_in_byte(negative_signaling_NaN,num)){
20356 str=_negative_sign+_signaling_nan;
20357 return true;
20358 }
20359 }
20360 if constexpr(::std::numeric_limits<T>::has_quiet_NaN){
20361 constexpr auto quiet_NaN = ::std::numeric_limits<T>::quiet_NaN();
20362 if(full_equal_in_byte(quiet_NaN,num)){
20363 str=_quiet_nan;
20364 return true;
20365 }
20366 auto negative_quiet_NaN = copy_as_negative(quiet_NaN);
20367 if(full_equal_in_byte(negative_quiet_NaN,num)){
20368 str=_negative_sign+_quiet_nan;
20369 return true;
20370 }
20371 }
20372 str=_nan+_unknown_data_start_sign;
20373 data_view<T> view{&num};
20374 for(const byte c: view){
20375 str += to_string_rough((unsigned char)c);
20376 str += _unknown_data_split_sign;
20377 }
20378 str.back() = _unknown_data_end_sign;
20379 return true;
20380 }
20381 }
20382 if constexpr(::std::numeric_limits<T>::has_infinity){
20383 if(::std::isinf(num)){
20384 if constexpr(!::std::is_unsigned_v<T>)
20385 if(is_negative){
20386 str=_negative_sign+_inf;
20387 return true;
20388 }
20389 str=_inf;
20390 return true;
20391 }
20392 }
20393 return false;
20394 }
20395 template<typename T> requires ::std::is_arithmetic_v<T>
20396 inline string to_string_rough_no_special_value_check(T num)const noexcept{
20397 string aret;
20398 const bool is_negative=magic_number::is_negative(num);
20399 typedef decltype(lambda{
20400 if constexpr(::std::is_unsigned_v<T>||::std::is_floating_point_v<T>)
20401 return T();
20402 else
20403 return::std::make_unsigned_t<T>();
20404 }()) UT;
20405 //符号转无符号而不是num=-num避免INT_MAX这种情况下的溢出
20406 UT unum=UT(num);
20407 if constexpr(!::std::is_unsigned_v<T>)
20408 if(is_negative){
20409 aret=_negative_sign;
20410 unum=UT(-num);
20411 }
20412 aret+=to_string_num_base(unum);
20413 return aret;
20414 }
20415 public:
20416 template<typename T> requires ::std::is_arithmetic_v<T>
20417 inline string to_string_rough(T num)const noexcept{
20418 string aret;
20419 const bool is_negative=magic_number::is_negative(num);
20420 if(to_string_special_value_check(num,aret,is_negative))
20421 return aret;
20422 return to_string_rough_no_special_value_check(num);
20423 }
20424 private:
20425 template<typename T>
20426 inline T from_string_get_num_base(string str)const noexcept{
20427 if constexpr(::std::is_floating_point_v<T>){
20428 size_t order_of_magnitude = str.size();
20429 T aret{};
20430 size_t i=str.size();
20431 while(i){
20432 i--;
20433 const size_t index=_radix_table.find(str[i]);
20434 if(index==string::npos){
20435 if(str[i] == _fractional_sign){
20436 order_of_magnitude=i;
20437 continue;
20438 }
20439 return T();
20440 }
20441 aret+=(T)index;
20442 aret/=_radix;
20443 }
20444 aret*=pow(_radix, order_of_magnitude);
20445 return aret;
20446 }
20447 else {
20448 T aret{};
20449 for(size_t i = 0; i < str.size(); i++){
20450 const size_t index = _radix_table.find(str[i]);
20451 if(index == string::npos)
20452 return T();
20453 aret *= (T)_radix;
20454 aret += (T)index;
20455 }
20456 return aret;
20457 }
20458 }
20459 template<typename T>
20460 inline bool from_string_special_value_check(string str,T& num,bool is_negative)const noexcept{
20461 if constexpr(::std::numeric_limits<T>::has_signaling_NaN || ::std::numeric_limits<T>::has_quiet_NaN){
20462 if constexpr(::std::numeric_limits<T>::has_signaling_NaN)
20463 if(str==_signaling_nan){
20464 num= copy_as_negative(::std::numeric_limits<T>::signaling_NaN(),is_negative);
20465 return true;
20466 }
20467 if constexpr(::std::numeric_limits<T>::has_quiet_NaN)
20468 if(str==_quiet_nan){
20469 num= copy_as_negative(::std::numeric_limits<T>::quiet_NaN(),is_negative);
20470 return true;
20471 }
20472 if(str.starts_with(_nan+_unknown_data_start_sign)){
20473 str.pop_front(_nan.size()+1);
20474 str.pop_back();
20475 suppress_msvc_warning(26494)//未初始化警告diss
20476 data_block<T> block;
20477 size_t write_index = 0;
20478 floop{
20479 const size_t dot_pos = str.find(_unknown_data_split_sign);
20480 auto byte_str = str.substr(0, dot_pos);
20481 block[write_index++] = (byte)from_string_get<unsigned char>(byte_str);
20482 if(dot_pos == string::npos)
20483 break;
20484 str = str.substr(dot_pos+1);
20485 }
20486 num= data_cast<T>(block);
20487 return true;
20488 }
20489 elseif(str == _nan){
20490 if constexpr(::std::numeric_limits<T>::has_quiet_NaN)
20491 num= copy_as_negative(::std::numeric_limits<T>::quiet_NaN(),is_negative);
20492 else
20493 num= copy_as_negative(::std::numeric_limits<T>::signaling_NaN(),is_negative);
20494 return true;
20495 }
20496 }
20497 if constexpr(::std::numeric_limits<T>::has_infinity){
20498 if(str==_inf){
20499 if(is_negative)
20500 return copy_as_negative(::std::numeric_limits<T>::infinity());
20501 else
20502 return ::std::numeric_limits<T>::infinity();
20503 return true;
20504 }
20505 }
20506 return false;
20507 }
20508 public:
20509 template<typename T> requires ::std::is_arithmetic_v<T>
20510 inline T from_string_get(string str)const noexcept{
20511 //信息尾检查
20512 if constexpr(::std::is_floating_point_v<T>){
20513 const auto info_tail_size=get_info_tail_size<T>();
20514 if(str.size()>info_tail_size){
20515 const auto tail_pos=str.size()-info_tail_size;
20516 auto info_tail=str.substr(tail_pos);
20517 auto str_with_out_tail=str.substr(0,tail_pos);
20518 if(str_with_out_tail.back()==_fractional_sign)
20519 str_with_out_tail.pop_back();
20520 auto num=get_from_info_tail<T>(info_tail);
20521 if(to_string_rough(num)==str_with_out_tail)
20522 return num;
20523 str_with_out_tail+=string{info_tail.size(),_radix_table[0]};
20524 if(to_string_rough(num)==str_with_out_tail)
20525 return num;
20526 }
20527 }
20528 T num{};
20529 suppress_msvc_warning(26496);
20530 bool is_negative=false;
20531 if constexpr(!::std::is_unsigned_v<T>)
20532 if(str[0]==_negative_sign){
20533 is_negative=true;
20534 str.pop_front();
20535 }
20536 if(str[0]==_positive_sign)
20537 str.pop_front();
20538 if(from_string_special_value_check(str,num,is_negative))
20539 return num;
20540 typedef decltype(lambda{
20541 if constexpr(::std::is_unsigned_v<T>||::std::is_floating_point_v<T>)
20542 return T();
20543 else
20544 return::std::make_unsigned_t<T>();
20545 }()) UT;
20546 UT unum=from_string_get_num_base<UT>(str);
20547 return copy_as_negative<T>(unum,is_negative);
20548 }
20549 template<typename T> requires ::std::is_arithmetic_v<T>
20550 inline string to_string(T num)const noexcept{
20551 string aret;
20552 if(to_string_special_value_check(num,aret,is_negative(num)))
20553 return aret;
20554 aret=to_string_rough_no_special_value_check(num);
20555 if constexpr(::std::is_floating_point_v<T>){
20556 //进位器
20557 auto rounding_up_char = lambda_with_catch(&) (string::arec_t char_arc)noexcept{
20558 const char_t up_char = move(char_arc);
20559 size_t up_pos = _radix_table.find(up_char);
20560 up_pos++;
20561 if(up_pos == _radix)
20562 up_pos = 0;
20563 move(char_arc) = _radix_table[up_pos];
20564 return up_pos == 0;
20565 };
20566 auto rounding_up = lambda_with_catch(&) (string&str)noexcept{
20567 size_t i = str.size();
20568 while(i){
20569 if(rounding_up_char(str[i])){
20570 if(i--){
20571 if(str[i] == _fractional_sign)
20572 i--;
20573 }
20574 else
20575 str.push_front(_radix_table[1]);
20576 continue;
20577 }
20578 else
20579 break;
20580 }
20581 };
20582 size_t dot_pos=aret.find(_fractional_sign);
20583 //检查是否可反向转换
20584 if(from_string_get<T>(aret) != num){
20585 //获取并追加信息尾
20586 string info_tail=get_info_tail(num);
20587 if(dot_pos==string::npos){
20588 if(aret.ends_with(string{info_tail.size(),_radix_table[0]}))
20589 aret.pop_back(info_tail.size());
20590 else
20591 aret.push_back(_fractional_sign);
20592 }
20593 aret+=info_tail;
20594 return aret;
20595 }
20596 {
20597 //二分法查找最合适的切割位点.
20598 size_t left_pos = 0;
20599 size_t right_pos = aret.size();
20600 string better_aret,better_aret_last;
20601 if(dot_pos==string::npos)
20602 dot_pos=aret.size();
20603 do {
20604 size_t step_pos = (left_pos + right_pos) / 2;
20605 better_aret = aret.substr(0, step_pos);
20606 if(step_pos==dot_pos)
20607 step_pos++;
20608 //判断是否需要进位.(当被截断内容在radix_table的后半部分.)
20609 const char_t cut_char = aret[step_pos];
20610 const size_t cut_num = _radix_table.find(cut_char);
20611 if(cut_num >= _radix / 2)
20612 rounding_up(better_aret);
20613 if(better_aret.size() < dot_pos)//0补全
20614 better_aret.resize(dot_pos,_radix_table[0]);
20615 //判断当前切割位点有效性.
20616 if(from_string_get<T>(better_aret) == num){
20617 if(better_aret.back() == _radix_table[0]){
20618 const auto end_pos = max(better_aret.find_last_not_of(_radix_table[0])+1, dot_pos);
20619 better_aret.resize(end_pos);
20620 if(better_aret.back() == _fractional_sign)
20621 better_aret.pop_back();
20622 }
20623 right_pos = min(better_aret.size(), step_pos);
20624 better_aret_last = better_aret;
20625 }
20626 elseif(left_pos != step_pos)
20627 left_pos = step_pos;
20628 else
20629 left_pos++;
20630 } while(left_pos < right_pos);
20631 if(better_aret_last){
20632 aret = better_aret_last;
20633 if(aret.ends_with(_fractional_sign))
20634 aret.pop_back();
20635 }
20636 }
20637 }
20638 return aret;
20639 }
20640 };
20642 distinctive inline numerical_representation_t trinary{3,es"012"_constexpr_str};
20643 distinctive inline numerical_representation_t binary{2,es"01"_constexpr_str};
20644 distinctive inline numerical_representation_t octal{8,es"01234567"_constexpr_str};
20645 distinctive inline numerical_representation_t decimal{10,es"0123456789"_constexpr_str};
20646 distinctive inline numerical_representation_t hexadecimal{16,es"0123456789abcdef"_constexpr_str};
20647 distinctive inline numerical_representation_t hexadecimal_upper{16,es"0123456789ABCDEF"_constexpr_str};
20649
20650 //字符串转换为数值
20651 template<typename T> requires ::std::is_arithmetic_v<T>
20652 inline T from_string_get(const string&str,const numerical_representation_t&radix=decimal)noexcept{
20653 return radix.from_string_get<T>(str);
20654 }
20655 //数值转换为字符串(小数部分粗略处理)
20656 template<typename T> requires ::std::is_arithmetic_v<T>
20657 inline string to_string_rough(T num,const numerical_representation_t&radix=decimal)noexcept{
20658 return radix.to_string_rough(num);
20659 }
20660 //数值转换为字符串
20661 template<typename T> requires ::std::is_arithmetic_v<T>
20662 inline string to_string(T num,const numerical_representation_t&radix=decimal)noexcept{
20663 return radix.to_string(num);
20664 }
20665
20666 //file_end
20667
20668 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20669 #if defined(ELC_TEST_ON)
20670 namespace numerical_representation_part_test{
20671 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_test.hpp"
20672 //_test.hpp
20673 /*
20674 未完成的elc解释器numerical_representation文件
20675 由steve02081504与Alex0125设计、编写
20676 转载时请在不对此文件做任何修改的同时注明出处
20677 项目地址:https://github.com/steve02081504/ELC
20678 */
20679 inline void test(){
20680 ELC_TEST_EVENTNAME("numerical_representation部分测试");
20681 }
20682 inline void test_log_out(){
20683 }
20684 inline void test_end(){
20685 }
20686
20687 //file_end
20688
20689 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20690 }
20691 #endif
20692
20693 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
20694 //_undefs.hpp
20695 /*
20696 未完成的elc解释器basic文件
20697 由steve02081504与Alex0125设计、编写
20698 转载时请在不对此文件做任何修改的同时注明出处
20699 项目地址:https://github.com/steve02081504/ELC
20700 */
20701 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
20702 //_undefs.hpp
20703 /*
20704 未完成的elc解释器_share文件
20705 由steve02081504与Alex0125设计、编写
20706 转载时请在不对此文件做任何修改的同时注明出处
20707 项目地址:https://github.com/steve02081504/ELC
20708 */
20709
20710 //defs at "_defs.hpp"
20711
20712 #if defined(_MSC_VER)
20713 #pragma warning(pop)
20714 #endif
20715 #undef suppress_msvc_warning
20716 #undef disable_msvc_warning
20717 #undef push_msvc_warning
20718 #undef pop_msvc_warning
20719 #undef push_and_disable_msvc_warning
20720
20721 //for basic_environment.hpp
20722 #undef BIT_POSSIBILITY
20723 //
20724 #if defined(ELC_VOID_NAME)
20725 #define void the_void
20726 #endif
20727
20728 // #undef often_noexcept
20729 #undef noexcept_as
20730 #undef noexcept_as_auto
20731 #undef constexpr_as
20732 #undef constexpr_as_auto
20733
20734 #undef using_method_from_base_t
20735 #undef using_method_from_value
20736
20737 #undef floop
20738 #undef enable_adl
20739
20740 #undef re_declvalue
20741 #undef re_decltype
20742
20743 #undef declvalue
20744
20745 #undef template_error
20746 #undef template_warning
20747
20748 #undef type_info_of
20749 #undef type_name_of
20750
20751 #undef is_common_attribute
20752 #undef is_special_attribute
20753
20754 #undef has_attribute
20755 #undef not_has_attribute
20756
20757 #undef float_size_of
20758 #undef bitnum_of
20759
20760 #undef def_common_attribute_with_nothing
20761 #undef def_special_attribute_with_nothing
20762
20763 #undef common_attribute_t
20764 #undef special_attribute_t
20765
20766 #undef enable_if
20767 #undef enabled_by_default
20768 #undef disabled_by_default
20769 #undef enable_if_not_ill_form
20770 #undef enable_flag
20771
20772 #undef was_an_ill_form
20773 #undef was_an_ill_form_with_parameter
20774 #undef was_not_an_ill_form
20775 #undef was_not_an_ill_form_and_noexcept
20776 #undef was_not_an_ill_form_with_parameter
20777
20778 #undef recursive_lambda
20779 #undef get_recursive_lambda_caller
20780 #undef lambda
20781 #undef lambda_with_catch
20782 #undef self_recursion
20783 #undef lambda_RLSRRS
20784
20785 #undef MAGIC
20786
20787 #undef nothing
20788
20789 #undef elseif
20790 #undef _big_than_
20791 #undef _small_than_
20792
20793 #if defined(_MSC_VER)
20794 #undef not
20795 #undef and
20796 #undef or
20797 #endif
20798
20799 #undef INTER_NAMESPACE
20800 #undef BREAK_NAMESPACE
20801
20802 #undef szie
20803 #undef form
20804
20805 #undef template_name
20806 #undef type_name
20807
20808 #undef not_in_debug
20809
20810 #undef es
20811 #undef ec
20812
20813 #undef ELC_TEST_EVENTNAME
20814
20815 #undef override_instance_struct
20816
20817 #undef distinctive
20818
20819 #undef force_inline
20820
20821 #undef with_no_vtable
20822
20823 #undef in_consteval
20824
20825 #undef no_vtable_struct
20826 #undef no_vtable_class
20827
20828 //file_end
20829
20830 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
20831
20832 //file_end
20833
20834 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20835 }
20836 namespace elc{
20837 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_export.hpp"
20838 //_export.hpp
20839 //at namespace elc
20840 /*
20841 未完成的elc解释器numerical_representation文件
20842 由steve02081504与Alex0125设计、编写
20843 转载时请在不对此文件做任何修改的同时注明出处
20844 项目地址:https://github.com/steve02081504/ELC
20845 */
20846 #define export using defs::
20847 export to_string;
20848 export to_string_rough;
20849 export from_string_get;
20850 #undef export
20851
20852 //file_end
20853
20854 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20855 }
20856
20857 //file_end
20858
20859 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
20860 #endif
20861
20862 //file_end
20863
20864 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
20865 #else
20866 #error ERROR_MSG_UNABLE_OS
20867 #endif
20869 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
20870 //_defs.hpp
20871 /*
20872 未完成的elc解释器_share文件
20873 由steve02081504与Alex0125设计、编写
20874 转载时请在不对此文件做任何修改的同时注明出处
20875 项目地址:https://github.com/steve02081504/ELC
20876 */
20877
20878 //undefs at "_undefs.hpp"
20879
20880 //set ELC_WARNING_LEVEL default to 4(max)
20881 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
20882
20883 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
20884 //basic_environment.hpp
20885 /*
20886 未完成的elc解释器_share文件
20887 由steve02081504与Alex0125设计、编写
20888 转载时请在不对此文件做任何修改的同时注明出处
20889 项目地址:https://github.com/steve02081504/ELC
20890 */
20891
20892 //每个bit(不是字节)的可能性
20893 //为什么c艹委员会不定义这个?
20894 #define BIT_POSSIBILITY 2
20895
20896 //file_end
20897
20898 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
20899
20900 #if defined(_MSC_VER)
20901 #pragma warning(push,ELC_WARNING_LEVEL)
20902 #pragma warning(disable:4099)//class与struct混用警告diss
20903 #pragma warning(disable:26812)//enum class安利diss.
20904 #pragma warning(disable:4584)//重复子类警告diss
20905 #pragma warning(disable:4250)//域控制继承警告diss
20906 #pragma warning(disable:26432)//不完全默认方法警告diss
20907 #pragma warning(disable:26435)//virtual override方法警告diss
20908 #pragma warning(disable:26481)//容器安利diss
20909 #pragma warning(disable:26446)//gsl::at安利diss
20910 #pragma warning(disable:26434)//方法覆盖警告diss
20911 #pragma warning(disable:26429)//gsl::not_null安利diss
20912 #pragma warning(disable:26471)//对void*进行static_cast安利diss
20913 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
20914 #pragma warning(disable:26473)//相同指针显式cast警告diss
20915 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
20916 #pragma warning(disable:26485)//数组作指针警告diss
20917 #pragma warning(disable:26490)//reinterpret_cast警告diss
20918 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
20919 #pragma warning(disable:26482)//非常数数组索引警告diss
20920 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
20921 #endif
20922 #if defined(_MSC_VER)
20923 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
20924 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
20925 #define push_msvc_warning() __pragma(warning(push))
20926 #define pop_msvc_warning() __pragma(warning(pop))
20927 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
20928 #else
20929 #define suppress_msvc_warning(...)
20930 #define disable_msvc_warning(...)
20931 #define push_msvc_warning()
20932 #define pop_msvc_warning()
20933 #define push_and_disable_msvc_warning(...)
20934 #endif
20935 //
20936 #if defined(ELC_VOID_NAME)
20937 #undef void
20938 #endif
20939
20940 // #define often_noexcept
20941 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
20942 #define noexcept_as_auto MAGIC//哦现在有了
20943 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
20944 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
20945
20946 #define using_method_from_base_t(name,...) \
20947 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
20948 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
20949 {\
20950 return base_t::name(forward<Args>(rest)...);\
20951 }\
20952
20953 #define using_method_from_value(name,value_name,...) \
20954 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
20955 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
20956 {\
20957 return value_name.name(forward<Args>(rest)...);\
20958 }\
20959
20960 #define floop while(__builtin_is_my_dick_still_there())
20961 #define enable_adl(name) void name()noexcept=delete
20962
20963 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
20964 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
20965
20966 #define declvalue(...) (::std::declval<__VA_ARGS__>())
20967
20968 /*实例化到此将引发错误*/
20969 #define template_error(reason) static_assert(template_error_helper<T>,reason)
20970 /*实例化到此将引发警告*/
20971 #define template_warning(reason) template_warning_helper<T>(reason)
20972
20973 //for type_info
20974 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
20975 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
20976
20977 #define is_common_attribute(name) public attribute<T,name<T>>
20978 #define is_special_attribute(name) public attribute<T,name>
20979
20980 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
20981 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
20982
20983 //for float_size_t
20984 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
20985 //bitnum_of
20986 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
20987
20988 //for attribute
20989 #define def_common_attribute_with_nothing(name) \
20990 template<typename T>\
20991 class name{}\
20992
20993 #define def_special_attribute_with_nothing(name) \
20994 class name{}\
20995
20996 #define common_attribute_t template<class>class
20997 #define special_attribute_t class
20998
20999 /*
21000 若参数的布尔值为零,那么此模板不会实例化
21001
21002 为什么不用cpp20的constraints?
21003 1.不能类内定义
21004 2.不能作为模板参数
21005 一句话总结:c艹标准会sb
21006 */
21007 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
21008 /*默认参与模板候选*/
21009 #define enabled_by_default class enable_state=void
21010 /*默认不参与模板候选*/
21011 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
21012 /*若参数为病式,那么此模板不会实例化*/
21013 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
21014 /*用于模板声明*/
21015 #define enable_flag class enable_state
21016
21017 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
21018 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
21019 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
21020 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
21021 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
21022
21023 /*让lambda递归更加美观*/
21024 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
21025 /*让lambda递归更加美观*/
21026 #define get_recursive_lambda_caller(name) \
21027 lambda_with_catch(&)(auto&&...Args){\
21028 return name(name,Args...);\
21029 }
21030 /*让lambda定义更加美观*/
21031 #define lambda []
21032 /*让lambda定义更加美观*/
21033 #define lambda_with_catch(...) [__VA_ARGS__]
21034 /*让lambda递归更加美观*/
21035 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
21036 //recursive_lambda_self_referential_reserved_symbolname
21037 #define lambda_RLSRRS _my_jb_super_sb_name_
21038
21039 #define MAGIC//ahh,ko no tenno da!
21040
21041 /*装饰性语法糖*/
21042 #define nothing
21043
21044 /*aya风格语法糖*/
21045 #define elseif else if
21046 /*aya风格语法糖*/
21047 #define _big_than_ >
21048 /*aya风格语法糖*/
21049 #define _small_than_ <
21050
21051 #if defined(_MSC_VER)
21052 #define not !
21053 #define and &&
21054 #define or ||
21055 #endif
21056
21057 /*进入名称空间,并不是很美观*/
21058 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
21059 /*退出名称空间,并不是很美观*/
21060 #define BREAK_NAMESPACE }
21061
21062 /*template说明符*/
21063 #define template_name template
21064 /*template说明符*/
21065 #define type_name class
21066
21067 #if defined(DEBUG) || defined(_DEBUG)
21068 #define not_in_debug 0
21069 #else
21070 #define not_in_debug 1
21071 #endif
21072
21073 #define es U""
21074 #define ec(ch) U ## ch
21075
21076 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
21077 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
21078 #else
21079 #define ELC_TEST_EVENTNAME(name)
21080 #endif
21081
21082 #define override_instance_struct \
21083 protected:\
21084 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
21085 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
21086 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
21087 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
21088 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
21089
21090 #if defined(_WIN32)
21091 #define distinctive __declspec(dllexport)
21092 #else
21093 #define distinctive
21094 #endif
21095
21096 #if defined(_WIN32)
21097 #define force_inline __forceinline
21098 #elif defined(__GNUC__)
21099 #define force_inline __attribute__((always_inline)) inline
21100 #else
21101 #define force_inline inline
21102 #endif
21103
21104 #if defined(_WIN32)
21105 #define with_no_vtable __declspec(novtable)
21106 #else
21107 #define with_no_vtable
21108 #endif
21109
21110 #define in_consteval (::std::is_constant_evaluated())
21111
21112 #define no_vtable_struct struct with_no_vtable
21113 #define no_vtable_class class with_no_vtable
21114
21115 //file_end
21116
21117 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
21118
21119 using namespace ::elc::defs;
21120
21121 typedef
21122 #if SYSTEM_TYPE == linux
21123 void*
21124 #elif SYSTEM_TYPE == windows
21125 HMODULE
21126 #endif
21128
21129 [[nodiscard]]inline library_handle base_load_library(const char*file_name)noexcept{
21130 //可返回bool意义为空的值表示失败
21131 return
21132 #if SYSTEM_TYPE == linux
21133 dlopen(file_name,RTLD_LAZY)
21134 #elif SYSTEM_TYPE == windows
21135 LoadLibraryA((LPCSTR)file_name)
21136 #endif
21137 ;
21138 }
21139 [[nodiscard]]inline string base_get_load_error()noexcept{
21140 return
21141 #if SYSTEM_TYPE == linux
21142 to_char_t_str(dlerror());
21143 #elif SYSTEM_TYPE == windows
21144 es"ERROR CODE:"_constexpr_str+to_string((DWORD)GetLastError());//傻逼微软设计的jb端口,再您妈的见
21145 #endif
21146 ;
21147 }
21148 inline void base_free_library(library_handle handle)noexcept{
21149 #if SYSTEM_TYPE == linux
21150 dlclose(handle)
21151 #elif SYSTEM_TYPE == windows
21152 FreeLibrary(handle)
21153 #endif
21154 ;
21155 }
21156 [[nodiscard]]inline void* base_get_symbol(library_handle handle,const char*symbol_name)noexcept{
21157 //可返回bool意义为空的值表示失败
21158 return
21159 #if SYSTEM_TYPE == linux
21160 dlsym(handle,symbol_name)
21161 #elif SYSTEM_TYPE == windows
21162 (void*)GetProcAddress(handle,(LPCSTR)symbol_name)
21163 #endif
21164 ;
21165 }
21166
21167 [[nodiscard]]inline library_handle load_library(string file_name)noexcept{
21168 //可返回bool意义为空的值表示失败
21169 return base_load_library(to_char_str(file_name).c_str());
21170 }
21171 [[nodiscard]]inline string get_load_error()noexcept{
21172 return base_get_load_error();
21173 }
21174 inline void free_library(library_handle handle)noexcept{
21175 return base_free_library(handle);
21176 }
21177 [[nodiscard]]inline void* get_symbol(library_handle handle,string symbol_name)noexcept{
21178 //可返回bool意义为空的值表示失败
21179 return base_get_symbol(handle,to_char_str(symbol_name).c_str());
21180 }
21181
21182 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
21183 //_undefs.hpp
21184 /*
21185 未完成的elc解释器_share文件
21186 由steve02081504与Alex0125设计、编写
21187 转载时请在不对此文件做任何修改的同时注明出处
21188 项目地址:https://github.com/steve02081504/ELC
21189 */
21190
21191 //defs at "_defs.hpp"
21192
21193 #if defined(_MSC_VER)
21194 #pragma warning(pop)
21195 #endif
21196 #undef suppress_msvc_warning
21197 #undef disable_msvc_warning
21198 #undef push_msvc_warning
21199 #undef pop_msvc_warning
21200 #undef push_and_disable_msvc_warning
21201
21202 //for basic_environment.hpp
21203 #undef BIT_POSSIBILITY
21204 //
21205 #if defined(ELC_VOID_NAME)
21206 #define void the_void
21207 #endif
21208
21209 // #undef often_noexcept
21210 #undef noexcept_as
21211 #undef noexcept_as_auto
21212 #undef constexpr_as
21213 #undef constexpr_as_auto
21214
21215 #undef using_method_from_base_t
21216 #undef using_method_from_value
21217
21218 #undef floop
21219 #undef enable_adl
21220
21221 #undef re_declvalue
21222 #undef re_decltype
21223
21224 #undef declvalue
21225
21226 #undef template_error
21227 #undef template_warning
21228
21229 #undef type_info_of
21230 #undef type_name_of
21231
21232 #undef is_common_attribute
21233 #undef is_special_attribute
21234
21235 #undef has_attribute
21236 #undef not_has_attribute
21237
21238 #undef float_size_of
21239 #undef bitnum_of
21240
21241 #undef def_common_attribute_with_nothing
21242 #undef def_special_attribute_with_nothing
21243
21244 #undef common_attribute_t
21245 #undef special_attribute_t
21246
21247 #undef enable_if
21248 #undef enabled_by_default
21249 #undef disabled_by_default
21250 #undef enable_if_not_ill_form
21251 #undef enable_flag
21252
21253 #undef was_an_ill_form
21254 #undef was_an_ill_form_with_parameter
21255 #undef was_not_an_ill_form
21256 #undef was_not_an_ill_form_and_noexcept
21257 #undef was_not_an_ill_form_with_parameter
21258
21259 #undef recursive_lambda
21260 #undef get_recursive_lambda_caller
21261 #undef lambda
21262 #undef lambda_with_catch
21263 #undef self_recursion
21264 #undef lambda_RLSRRS
21265
21266 #undef MAGIC
21267
21268 #undef nothing
21269
21270 #undef elseif
21271 #undef _big_than_
21272 #undef _small_than_
21273
21274 #if defined(_MSC_VER)
21275 #undef not
21276 #undef and
21277 #undef or
21278 #endif
21279
21280 #undef INTER_NAMESPACE
21281 #undef BREAK_NAMESPACE
21282
21283 #undef szie
21284 #undef form
21285
21286 #undef template_name
21287 #undef type_name
21288
21289 #undef not_in_debug
21290
21291 #undef es
21292 #undef ec
21293
21294 #undef ELC_TEST_EVENTNAME
21295
21296 #undef override_instance_struct
21297
21298 #undef distinctive
21299
21300 #undef force_inline
21301
21302 #undef with_no_vtable
21303
21304 #undef in_consteval
21305
21306 #undef no_vtable_struct
21307 #undef no_vtable_class
21308
21309 //file_end
21310
21311 #line 94 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
21312 }
21313 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/undef_decl_system_type.hpp"
21314 //undef_decl_system_type.hpp
21315 /*
21316 未完成的elc解释器_share文件
21317 由steve02081504与Alex0125设计、编写
21318 转载时请在不对此文件做任何修改的同时注明出处
21319 项目地址:https://github.com/steve02081504/ELC
21320 */
21321 //copy&rewrite from steve02081504/evest.h
21322 #undef linux
21323 #undef windows
21324 #undef other
21325 #undef SYSTEM_TYPE
21326 #undef ERROR_MSG_UNABLE_OS
21327
21328 //file_end
21329
21330 #line 96 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
21331 #endif
21332
21333 //file_end
21334
21335 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21336 //include locale:自然语言相关的字符串
21337 //strings
21338 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
21339 //using.hpp
21340 /*
21341 未完成的elc解释器_share文件
21342 由steve02081504与Alex0125设计、编写
21343 转载时请在不对此文件做任何修改的同时注明出处
21344 项目地址:https://github.com/steve02081504/ELC
21345 */
21346 /*
21347 locale说明
21348 elc使用的字符串.
21349 调整这些,实现快速本地化.
21350 */
21351 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
21352
21353 //file_end
21354
21355 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21356 namespace elc::defs{
21357 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
21358 //_defs.hpp
21359 /*
21360 未完成的elc解释器basic文件
21361 由steve02081504与Alex0125设计、编写
21362 转载时请在不对此文件做任何修改的同时注明出处
21363 项目地址:https://github.com/steve02081504/ELC
21364 */
21365 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21366 //_defs.hpp
21367 /*
21368 未完成的elc解释器_share文件
21369 由steve02081504与Alex0125设计、编写
21370 转载时请在不对此文件做任何修改的同时注明出处
21371 项目地址:https://github.com/steve02081504/ELC
21372 */
21373
21374 //undefs at "_undefs.hpp"
21375
21376 //set ELC_WARNING_LEVEL default to 4(max)
21377 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21378
21379 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
21380 //basic_environment.hpp
21381 /*
21382 未完成的elc解释器_share文件
21383 由steve02081504与Alex0125设计、编写
21384 转载时请在不对此文件做任何修改的同时注明出处
21385 项目地址:https://github.com/steve02081504/ELC
21386 */
21387
21388 //每个bit(不是字节)的可能性
21389 //为什么c艹委员会不定义这个?
21390 #define BIT_POSSIBILITY 2
21391
21392 //file_end
21393
21394 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21395
21396 #if defined(_MSC_VER)
21397 #pragma warning(push,ELC_WARNING_LEVEL)
21398 #pragma warning(disable:4099)//class与struct混用警告diss
21399 #pragma warning(disable:26812)//enum class安利diss.
21400 #pragma warning(disable:4584)//重复子类警告diss
21401 #pragma warning(disable:4250)//域控制继承警告diss
21402 #pragma warning(disable:26432)//不完全默认方法警告diss
21403 #pragma warning(disable:26435)//virtual override方法警告diss
21404 #pragma warning(disable:26481)//容器安利diss
21405 #pragma warning(disable:26446)//gsl::at安利diss
21406 #pragma warning(disable:26434)//方法覆盖警告diss
21407 #pragma warning(disable:26429)//gsl::not_null安利diss
21408 #pragma warning(disable:26471)//对void*进行static_cast安利diss
21409 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
21410 #pragma warning(disable:26473)//相同指针显式cast警告diss
21411 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
21412 #pragma warning(disable:26485)//数组作指针警告diss
21413 #pragma warning(disable:26490)//reinterpret_cast警告diss
21414 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
21415 #pragma warning(disable:26482)//非常数数组索引警告diss
21416 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
21417 #endif
21418 #if defined(_MSC_VER)
21419 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
21420 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
21421 #define push_msvc_warning() __pragma(warning(push))
21422 #define pop_msvc_warning() __pragma(warning(pop))
21423 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
21424 #else
21425 #define suppress_msvc_warning(...)
21426 #define disable_msvc_warning(...)
21427 #define push_msvc_warning()
21428 #define pop_msvc_warning()
21429 #define push_and_disable_msvc_warning(...)
21430 #endif
21431 //
21432 #if defined(ELC_VOID_NAME)
21433 #undef void
21434 #endif
21435
21436 // #define often_noexcept
21437 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
21438 #define noexcept_as_auto MAGIC//哦现在有了
21439 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
21440 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
21441
21442 #define using_method_from_base_t(name,...) \
21443 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
21444 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
21445 {\
21446 return base_t::name(forward<Args>(rest)...);\
21447 }\
21448
21449 #define using_method_from_value(name,value_name,...) \
21450 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
21451 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
21452 {\
21453 return value_name.name(forward<Args>(rest)...);\
21454 }\
21455
21456 #define floop while(__builtin_is_my_dick_still_there())
21457 #define enable_adl(name) void name()noexcept=delete
21458
21459 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
21460 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
21461
21462 #define declvalue(...) (::std::declval<__VA_ARGS__>())
21463
21464 /*实例化到此将引发错误*/
21465 #define template_error(reason) static_assert(template_error_helper<T>,reason)
21466 /*实例化到此将引发警告*/
21467 #define template_warning(reason) template_warning_helper<T>(reason)
21468
21469 //for type_info
21470 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
21471 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
21472
21473 #define is_common_attribute(name) public attribute<T,name<T>>
21474 #define is_special_attribute(name) public attribute<T,name>
21475
21476 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
21477 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
21478
21479 //for float_size_t
21480 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
21481 //bitnum_of
21482 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
21483
21484 //for attribute
21485 #define def_common_attribute_with_nothing(name) \
21486 template<typename T>\
21487 class name{}\
21488
21489 #define def_special_attribute_with_nothing(name) \
21490 class name{}\
21491
21492 #define common_attribute_t template<class>class
21493 #define special_attribute_t class
21494
21495 /*
21496 若参数的布尔值为零,那么此模板不会实例化
21497
21498 为什么不用cpp20的constraints?
21499 1.不能类内定义
21500 2.不能作为模板参数
21501 一句话总结:c艹标准会sb
21502 */
21503 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
21504 /*默认参与模板候选*/
21505 #define enabled_by_default class enable_state=void
21506 /*默认不参与模板候选*/
21507 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
21508 /*若参数为病式,那么此模板不会实例化*/
21509 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
21510 /*用于模板声明*/
21511 #define enable_flag class enable_state
21512
21513 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
21514 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
21515 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
21516 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
21517 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
21518
21519 /*让lambda递归更加美观*/
21520 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
21521 /*让lambda递归更加美观*/
21522 #define get_recursive_lambda_caller(name) \
21523 lambda_with_catch(&)(auto&&...Args){\
21524 return name(name,Args...);\
21525 }
21526 /*让lambda定义更加美观*/
21527 #define lambda []
21528 /*让lambda定义更加美观*/
21529 #define lambda_with_catch(...) [__VA_ARGS__]
21530 /*让lambda递归更加美观*/
21531 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
21532 //recursive_lambda_self_referential_reserved_symbolname
21533 #define lambda_RLSRRS _my_jb_super_sb_name_
21534
21535 #define MAGIC//ahh,ko no tenno da!
21536
21537 /*装饰性语法糖*/
21538 #define nothing
21539
21540 /*aya风格语法糖*/
21541 #define elseif else if
21542 /*aya风格语法糖*/
21543 #define _big_than_ >
21544 /*aya风格语法糖*/
21545 #define _small_than_ <
21546
21547 #if defined(_MSC_VER)
21548 #define not !
21549 #define and &&
21550 #define or ||
21551 #endif
21552
21553 /*进入名称空间,并不是很美观*/
21554 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
21555 /*退出名称空间,并不是很美观*/
21556 #define BREAK_NAMESPACE }
21557
21558 /*template说明符*/
21559 #define template_name template
21560 /*template说明符*/
21561 #define type_name class
21562
21563 #if defined(DEBUG) || defined(_DEBUG)
21564 #define not_in_debug 0
21565 #else
21566 #define not_in_debug 1
21567 #endif
21568
21569 #define es U""
21570 #define ec(ch) U ## ch
21571
21572 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
21573 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
21574 #else
21575 #define ELC_TEST_EVENTNAME(name)
21576 #endif
21577
21578 #define override_instance_struct \
21579 protected:\
21580 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
21581 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
21582 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
21583 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
21584 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
21585
21586 #if defined(_WIN32)
21587 #define distinctive __declspec(dllexport)
21588 #else
21589 #define distinctive
21590 #endif
21591
21592 #if defined(_WIN32)
21593 #define force_inline __forceinline
21594 #elif defined(__GNUC__)
21595 #define force_inline __attribute__((always_inline)) inline
21596 #else
21597 #define force_inline inline
21598 #endif
21599
21600 #if defined(_WIN32)
21601 #define with_no_vtable __declspec(novtable)
21602 #else
21603 #define with_no_vtable
21604 #endif
21605
21606 #define in_consteval (::std::is_constant_evaluated())
21607
21608 #define no_vtable_struct struct with_no_vtable
21609 #define no_vtable_class class with_no_vtable
21610
21611 //file_end
21612
21613 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
21614
21615 //file_end
21616
21617 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21618
21619 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/lib_loader.hpp"
21620 //lib_loader.hpp
21621 //at namespace elc
21622 /*
21623 未完成的elc解释器base文件
21624 由steve02081504与Alex0125设计、编写
21625 转载时请在不对此文件做任何修改的同时注明出处
21626 项目地址:https://github.com/steve02081504/ELC
21627 */
21628 namespace lib_loader_n{
21629 using namespace ::elc::APIs::library_load;
21630
21631 struct library_info_t;
21632 typedef comn_ptr_t<library_info_t> library_handle_t;
21633
21635 with_common_attribute<ref_able,never_in_array>,build_by_get_only{
21636 private:
21637 library_handle _m;
21638 string _name;
21639 string _error;
21640 public:
21641 constexpr explicit library_info_t(special_init_t)noexcept{
21642 _m=library_handle{0};
21643 _error=locale::str::lib_load::null_lib;
21644 attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero();
21645 }
21646 explicit library_info_t(string lib_name)noexcept{
21647 _name=lib_name;
21648 _m=load_library(lib_name);
21649
21650 if(!_m)
21651 _error=get_load_error();
21652 }
21654 free_library(_m);
21655 }
21656 [[nodiscard]]explicit operator bool()const noexcept{
21657 return bool(_m);
21658 }
21659 [[nodiscard]]string get_error()noexcept{
21660 return _error;
21661 }
21662 [[nodiscard]]string get_name()noexcept{
21663 return _name;
21664 }
21665
21666 [[nodiscard]]void*get_symbol(string symbol_name)noexcept{
21667 return APIs::library_load::get_symbol(_m,symbol_name);
21668 }
21669 template<class symbol_t>
21670 [[nodiscard]]symbol_t&get_symbol_as(string symbol_name)noexcept{
21671 return*reinterpret_cast<symbol_t*>(get_symbol(symbol_name));
21672 }
21673 template<class Func_t>
21674 [[nodiscard]]function_t<Func_t>get_symbol_as_function(string symbol_name)noexcept;
21675 };
21676 [[nodiscard]]inline bool the_pointer_to_bool(const library_info_t*a)noexcept{
21677 return a->operator bool();
21678 }
21680 [[nodiscard]]inline constexpr library_info_t*the_get_null_ptr(const library_info_t*)noexcept{return&null_lib;}
21681
21682 /*
21683 base_symbol_t
21684 容纳一个library_handle_t以引用计数lib资源
21685 同时容纳自身的符号名以方便反向查找名称
21686 */
21689 string _name;
21690 };
21691 /*
21692 symbol_t
21693 继承function_data_warpper_t的operator()以可转换为function_t
21694 继承base_symbol_t以对lib的引用计数和包含更多相关信息
21695 */
21696 template<class Func_t>
21697 struct symbol_t;
21698 #if !defined(_MSC_VER)
21699 template<class Ret_t,class...Args_t,bool nothrow>
21700 struct symbol_t<Ret_t(Args_t...)noexcept(nothrow)>:function_data_warpper_t<Ret_t(*)(Args_t...)noexcept(nothrow)>,base_symbol_t{
21701 symbol_t(library_handle_t lib,string symbol_name,Ret_t(*self)(Args_t...)noexcept(nothrow))noexcept:
21702 function_data_warpper_t<Ret_t(*)(Args_t...)noexcept(nothrow)>(self),base_symbol_t(lib,symbol_name){}
21703 };
21704 #else
21705 //MSVC,我滴垃圾堆
21706 template<class Ret_t,class...Args_t>
21707 struct symbol_t<Ret_t(Args_t...)>:function_data_warpper_t<Ret_t(*)(Args_t...)>,base_symbol_t{
21708 symbol_t(library_handle_t lib,string symbol_name,Ret_t(*self)(Args_t...))noexcept:
21709 function_data_warpper_t<Ret_t(*)(Args_t...)>(self),base_symbol_t(lib,symbol_name){}
21710 };
21711 template<class Ret_t,class...Args_t>
21712 struct symbol_t<Ret_t(Args_t...)noexcept>:function_data_warpper_t<Ret_t(*)(Args_t...)noexcept>,base_symbol_t{
21713 symbol_t(library_handle_t lib,string symbol_name,Ret_t(*self)(Args_t...)noexcept)noexcept:
21714 function_data_warpper_t<Ret_t(*)(Args_t...)noexcept>(self),base_symbol_t(lib,symbol_name){}
21715 };
21716 #endif
21717
21718 template<class Func_t>
21719 [[nodiscard]]inline function_t<Func_t>library_info_t::get_symbol_as_function(string symbol_name)noexcept{
21720 auto func_p=&get_symbol_as<Func_t>(symbol_name);
21721 if(!func_p)
21722 return null_ptr;
21723 else
21724 return symbol_t<Func_t>(this,symbol_name,func_p);
21725 }
21726
21727 [[nodiscard]]inline library_handle_t load_lib(string lib_name)noexcept{
21728 return get<library_info_t>(lib_name);
21729 }
21730 template<class Func_t>
21731 [[nodiscard]]inline library_handle_t get_library_handle_form_symbol(function_t<Func_t> symbol)noexcept{
21732 auto symbol_info=symbol.get_as<base_symbol_t>();
21733 if(symbol_info.fail())
21734 return null_ptr;
21735 else
21736 return symbol_info.get_ref()._lib;
21737 }
21738 template<class Func_t>
21739 [[nodiscard]]inline string get_symbol_name_form_symbol(function_t<Func_t> symbol)noexcept{
21740 auto symbol_info=symbol.get_as<base_symbol_t>();
21741 if(symbol_info.fail())
21742 return {};
21743 else
21744 return symbol_info.get_ref()._name;
21745 }
21746 }
21747
21748 //file_end
21749
21750 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21751 #if defined(ELC_TEST_ON)
21752 namespace lib_loader_part_test{
21753 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_test.hpp"
21754 //_test.hpp
21755 /*
21756 未完成的elc解释器template文件
21757 由steve02081504与Alex0125设计、编写
21758 转载时请在不对此文件做任何修改的同时注明出处
21759 项目地址:https://github.com/steve02081504/ELC
21760 */
21761 inline void test(){
21762 ELC_TEST_EVENTNAME("lib_loader部分测试");
21763 }
21764 inline void test_log_out(){}
21765 inline void test_end{}
21766
21767 //file_end
21768
21769 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21770 }
21771 #endif
21772
21773 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
21774 //_undefs.hpp
21775 /*
21776 未完成的elc解释器basic文件
21777 由steve02081504与Alex0125设计、编写
21778 转载时请在不对此文件做任何修改的同时注明出处
21779 项目地址:https://github.com/steve02081504/ELC
21780 */
21781 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
21782 //_undefs.hpp
21783 /*
21784 未完成的elc解释器_share文件
21785 由steve02081504与Alex0125设计、编写
21786 转载时请在不对此文件做任何修改的同时注明出处
21787 项目地址:https://github.com/steve02081504/ELC
21788 */
21789
21790 //defs at "_defs.hpp"
21791
21792 #if defined(_MSC_VER)
21793 #pragma warning(pop)
21794 #endif
21795 #undef suppress_msvc_warning
21796 #undef disable_msvc_warning
21797 #undef push_msvc_warning
21798 #undef pop_msvc_warning
21799 #undef push_and_disable_msvc_warning
21800
21801 //for basic_environment.hpp
21802 #undef BIT_POSSIBILITY
21803 //
21804 #if defined(ELC_VOID_NAME)
21805 #define void the_void
21806 #endif
21807
21808 // #undef often_noexcept
21809 #undef noexcept_as
21810 #undef noexcept_as_auto
21811 #undef constexpr_as
21812 #undef constexpr_as_auto
21813
21814 #undef using_method_from_base_t
21815 #undef using_method_from_value
21816
21817 #undef floop
21818 #undef enable_adl
21819
21820 #undef re_declvalue
21821 #undef re_decltype
21822
21823 #undef declvalue
21824
21825 #undef template_error
21826 #undef template_warning
21827
21828 #undef type_info_of
21829 #undef type_name_of
21830
21831 #undef is_common_attribute
21832 #undef is_special_attribute
21833
21834 #undef has_attribute
21835 #undef not_has_attribute
21836
21837 #undef float_size_of
21838 #undef bitnum_of
21839
21840 #undef def_common_attribute_with_nothing
21841 #undef def_special_attribute_with_nothing
21842
21843 #undef common_attribute_t
21844 #undef special_attribute_t
21845
21846 #undef enable_if
21847 #undef enabled_by_default
21848 #undef disabled_by_default
21849 #undef enable_if_not_ill_form
21850 #undef enable_flag
21851
21852 #undef was_an_ill_form
21853 #undef was_an_ill_form_with_parameter
21854 #undef was_not_an_ill_form
21855 #undef was_not_an_ill_form_and_noexcept
21856 #undef was_not_an_ill_form_with_parameter
21857
21858 #undef recursive_lambda
21859 #undef get_recursive_lambda_caller
21860 #undef lambda
21861 #undef lambda_with_catch
21862 #undef self_recursion
21863 #undef lambda_RLSRRS
21864
21865 #undef MAGIC
21866
21867 #undef nothing
21868
21869 #undef elseif
21870 #undef _big_than_
21871 #undef _small_than_
21872
21873 #if defined(_MSC_VER)
21874 #undef not
21875 #undef and
21876 #undef or
21877 #endif
21878
21879 #undef INTER_NAMESPACE
21880 #undef BREAK_NAMESPACE
21881
21882 #undef szie
21883 #undef form
21884
21885 #undef template_name
21886 #undef type_name
21887
21888 #undef not_in_debug
21889
21890 #undef es
21891 #undef ec
21892
21893 #undef ELC_TEST_EVENTNAME
21894
21895 #undef override_instance_struct
21896
21897 #undef distinctive
21898
21899 #undef force_inline
21900
21901 #undef with_no_vtable
21902
21903 #undef in_consteval
21904
21905 #undef no_vtable_struct
21906 #undef no_vtable_class
21907
21908 //file_end
21909
21910 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
21911
21912 //file_end
21913
21914 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21915 }
21916 namespace elc{
21917 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_export.hpp"
21918 //_export.hpp
21919 //at namespace elc
21920 /*
21921 未完成的elc解释器template文件
21922 由steve02081504与Alex0125设计、编写
21923 转载时请在不对此文件做任何修改的同时注明出处
21924 项目地址:https://github.com/steve02081504/ELC
21925 */
21926 #define export using defs::lib_loader_n::
21931 #undef export
21932
21933 //file_end
21934
21935 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21936 }
21937
21938 //file_end
21939
21940 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
21941 #endif
21942
21943 //file_end
21944
21945 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
21946 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/literal"
21947 //literal
21948 //at namespace ::
21949 /*
21950 未完成的elc解释器include文件
21951 由steve02081504与Alex0125设计、编写
21952 转载时请在不对此文件做任何修改的同时注明出处
21953 项目地址:https://github.com/steve02081504/ELC
21954 */
21955 #if !defined(ELC_LITERAL)
21956 #define ELC_LITERAL
21957 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
21958 //_body.hpp
21959 //at namespace ::
21960 /*
21961 未完成的elc解释器literal文件
21962 由steve02081504与Alex0125设计、编写
21963 转载时请在不对此文件做任何修改的同时注明出处
21964 项目地址:https://github.com/steve02081504/ELC
21965 */
21966 #if defined(ELC_TEST)
21967 #error "this part cannot be tested."
21968 #endif
21969 namespace elc::defs{
21970 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
21971 //_defs.hpp
21972 /*
21973 未完成的elc解释器basic文件
21974 由steve02081504与Alex0125设计、编写
21975 转载时请在不对此文件做任何修改的同时注明出处
21976 项目地址:https://github.com/steve02081504/ELC
21977 */
21978 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21979 //_defs.hpp
21980 /*
21981 未完成的elc解释器_share文件
21982 由steve02081504与Alex0125设计、编写
21983 转载时请在不对此文件做任何修改的同时注明出处
21984 项目地址:https://github.com/steve02081504/ELC
21985 */
21986
21987 //undefs at "_undefs.hpp"
21988
21989 //set ELC_WARNING_LEVEL default to 4(max)
21990 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21991
21992 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
21993 //basic_environment.hpp
21994 /*
21995 未完成的elc解释器_share文件
21996 由steve02081504与Alex0125设计、编写
21997 转载时请在不对此文件做任何修改的同时注明出处
21998 项目地址:https://github.com/steve02081504/ELC
21999 */
22000
22001 //每个bit(不是字节)的可能性
22002 //为什么c艹委员会不定义这个?
22003 #define BIT_POSSIBILITY 2
22004
22005 //file_end
22006
22007 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22008
22009 #if defined(_MSC_VER)
22010 #pragma warning(push,ELC_WARNING_LEVEL)
22011 #pragma warning(disable:4099)//class与struct混用警告diss
22012 #pragma warning(disable:26812)//enum class安利diss.
22013 #pragma warning(disable:4584)//重复子类警告diss
22014 #pragma warning(disable:4250)//域控制继承警告diss
22015 #pragma warning(disable:26432)//不完全默认方法警告diss
22016 #pragma warning(disable:26435)//virtual override方法警告diss
22017 #pragma warning(disable:26481)//容器安利diss
22018 #pragma warning(disable:26446)//gsl::at安利diss
22019 #pragma warning(disable:26434)//方法覆盖警告diss
22020 #pragma warning(disable:26429)//gsl::not_null安利diss
22021 #pragma warning(disable:26471)//对void*进行static_cast安利diss
22022 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
22023 #pragma warning(disable:26473)//相同指针显式cast警告diss
22024 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
22025 #pragma warning(disable:26485)//数组作指针警告diss
22026 #pragma warning(disable:26490)//reinterpret_cast警告diss
22027 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
22028 #pragma warning(disable:26482)//非常数数组索引警告diss
22029 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
22030 #endif
22031 #if defined(_MSC_VER)
22032 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
22033 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
22034 #define push_msvc_warning() __pragma(warning(push))
22035 #define pop_msvc_warning() __pragma(warning(pop))
22036 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
22037 #else
22038 #define suppress_msvc_warning(...)
22039 #define disable_msvc_warning(...)
22040 #define push_msvc_warning()
22041 #define pop_msvc_warning()
22042 #define push_and_disable_msvc_warning(...)
22043 #endif
22044 //
22045 #if defined(ELC_VOID_NAME)
22046 #undef void
22047 #endif
22048
22049 // #define often_noexcept
22050 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
22051 #define noexcept_as_auto MAGIC//哦现在有了
22052 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
22053 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
22054
22055 #define using_method_from_base_t(name,...) \
22056 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
22057 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
22058 {\
22059 return base_t::name(forward<Args>(rest)...);\
22060 }\
22061
22062 #define using_method_from_value(name,value_name,...) \
22063 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
22064 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
22065 {\
22066 return value_name.name(forward<Args>(rest)...);\
22067 }\
22068
22069 #define floop while(__builtin_is_my_dick_still_there())
22070 #define enable_adl(name) void name()noexcept=delete
22071
22072 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
22073 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
22074
22075 #define declvalue(...) (::std::declval<__VA_ARGS__>())
22076
22077 /*实例化到此将引发错误*/
22078 #define template_error(reason) static_assert(template_error_helper<T>,reason)
22079 /*实例化到此将引发警告*/
22080 #define template_warning(reason) template_warning_helper<T>(reason)
22081
22082 //for type_info
22083 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
22084 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
22085
22086 #define is_common_attribute(name) public attribute<T,name<T>>
22087 #define is_special_attribute(name) public attribute<T,name>
22088
22089 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
22090 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
22091
22092 //for float_size_t
22093 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
22094 //bitnum_of
22095 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
22096
22097 //for attribute
22098 #define def_common_attribute_with_nothing(name) \
22099 template<typename T>\
22100 class name{}\
22101
22102 #define def_special_attribute_with_nothing(name) \
22103 class name{}\
22104
22105 #define common_attribute_t template<class>class
22106 #define special_attribute_t class
22107
22108 /*
22109 若参数的布尔值为零,那么此模板不会实例化
22110
22111 为什么不用cpp20的constraints?
22112 1.不能类内定义
22113 2.不能作为模板参数
22114 一句话总结:c艹标准会sb
22115 */
22116 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
22117 /*默认参与模板候选*/
22118 #define enabled_by_default class enable_state=void
22119 /*默认不参与模板候选*/
22120 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
22121 /*若参数为病式,那么此模板不会实例化*/
22122 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
22123 /*用于模板声明*/
22124 #define enable_flag class enable_state
22125
22126 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
22127 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
22128 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
22129 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
22130 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
22131
22132 /*让lambda递归更加美观*/
22133 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
22134 /*让lambda递归更加美观*/
22135 #define get_recursive_lambda_caller(name) \
22136 lambda_with_catch(&)(auto&&...Args){\
22137 return name(name,Args...);\
22138 }
22139 /*让lambda定义更加美观*/
22140 #define lambda []
22141 /*让lambda定义更加美观*/
22142 #define lambda_with_catch(...) [__VA_ARGS__]
22143 /*让lambda递归更加美观*/
22144 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
22145 //recursive_lambda_self_referential_reserved_symbolname
22146 #define lambda_RLSRRS _my_jb_super_sb_name_
22147
22148 #define MAGIC//ahh,ko no tenno da!
22149
22150 /*装饰性语法糖*/
22151 #define nothing
22152
22153 /*aya风格语法糖*/
22154 #define elseif else if
22155 /*aya风格语法糖*/
22156 #define _big_than_ >
22157 /*aya风格语法糖*/
22158 #define _small_than_ <
22159
22160 #if defined(_MSC_VER)
22161 #define not !
22162 #define and &&
22163 #define or ||
22164 #endif
22165
22166 /*进入名称空间,并不是很美观*/
22167 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
22168 /*退出名称空间,并不是很美观*/
22169 #define BREAK_NAMESPACE }
22170
22171 /*template说明符*/
22172 #define template_name template
22173 /*template说明符*/
22174 #define type_name class
22175
22176 #if defined(DEBUG) || defined(_DEBUG)
22177 #define not_in_debug 0
22178 #else
22179 #define not_in_debug 1
22180 #endif
22181
22182 #define es U""
22183 #define ec(ch) U ## ch
22184
22185 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
22186 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
22187 #else
22188 #define ELC_TEST_EVENTNAME(name)
22189 #endif
22190
22191 #define override_instance_struct \
22192 protected:\
22193 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
22194 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
22195 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
22196 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
22197 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
22198
22199 #if defined(_WIN32)
22200 #define distinctive __declspec(dllexport)
22201 #else
22202 #define distinctive
22203 #endif
22204
22205 #if defined(_WIN32)
22206 #define force_inline __forceinline
22207 #elif defined(__GNUC__)
22208 #define force_inline __attribute__((always_inline)) inline
22209 #else
22210 #define force_inline inline
22211 #endif
22212
22213 #if defined(_WIN32)
22214 #define with_no_vtable __declspec(novtable)
22215 #else
22216 #define with_no_vtable
22217 #endif
22218
22219 #define in_consteval (::std::is_constant_evaluated())
22220
22221 #define no_vtable_struct struct with_no_vtable
22222 #define no_vtable_class class with_no_vtable
22223
22224 //file_end
22225
22226 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
22227
22228 //file_end
22229
22230 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22231
22232 #if defined(ELC_TEST_ON)
22233 namespace literal_part_test{
22234 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_test.hpp"
22235 //_test.hpp
22236 /*
22237 未完成的elc解释器literal文件
22238 由steve02081504与Alex0125设计、编写
22239 转载时请在不对此文件做任何修改的同时注明出处
22240 项目地址:https://github.com/steve02081504/ELC
22241 */
22242 inline void test(){
22243 ELC_TEST_EVENTNAME("literal部分测试");
22244 }
22245 inline void test_log_out(){
22246 }
22247 inline void test_end{
22248 }
22249
22250 //file_end
22251
22252 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22253 }
22254 #endif
22255
22256 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22257 //_undefs.hpp
22258 /*
22259 未完成的elc解释器basic文件
22260 由steve02081504与Alex0125设计、编写
22261 转载时请在不对此文件做任何修改的同时注明出处
22262 项目地址:https://github.com/steve02081504/ELC
22263 */
22264 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
22265 //_undefs.hpp
22266 /*
22267 未完成的elc解释器_share文件
22268 由steve02081504与Alex0125设计、编写
22269 转载时请在不对此文件做任何修改的同时注明出处
22270 项目地址:https://github.com/steve02081504/ELC
22271 */
22272
22273 //defs at "_defs.hpp"
22274
22275 #if defined(_MSC_VER)
22276 #pragma warning(pop)
22277 #endif
22278 #undef suppress_msvc_warning
22279 #undef disable_msvc_warning
22280 #undef push_msvc_warning
22281 #undef pop_msvc_warning
22282 #undef push_and_disable_msvc_warning
22283
22284 //for basic_environment.hpp
22285 #undef BIT_POSSIBILITY
22286 //
22287 #if defined(ELC_VOID_NAME)
22288 #define void the_void
22289 #endif
22290
22291 // #undef often_noexcept
22292 #undef noexcept_as
22293 #undef noexcept_as_auto
22294 #undef constexpr_as
22295 #undef constexpr_as_auto
22296
22297 #undef using_method_from_base_t
22298 #undef using_method_from_value
22299
22300 #undef floop
22301 #undef enable_adl
22302
22303 #undef re_declvalue
22304 #undef re_decltype
22305
22306 #undef declvalue
22307
22308 #undef template_error
22309 #undef template_warning
22310
22311 #undef type_info_of
22312 #undef type_name_of
22313
22314 #undef is_common_attribute
22315 #undef is_special_attribute
22316
22317 #undef has_attribute
22318 #undef not_has_attribute
22319
22320 #undef float_size_of
22321 #undef bitnum_of
22322
22323 #undef def_common_attribute_with_nothing
22324 #undef def_special_attribute_with_nothing
22325
22326 #undef common_attribute_t
22327 #undef special_attribute_t
22328
22329 #undef enable_if
22330 #undef enabled_by_default
22331 #undef disabled_by_default
22332 #undef enable_if_not_ill_form
22333 #undef enable_flag
22334
22335 #undef was_an_ill_form
22336 #undef was_an_ill_form_with_parameter
22337 #undef was_not_an_ill_form
22338 #undef was_not_an_ill_form_and_noexcept
22339 #undef was_not_an_ill_form_with_parameter
22340
22341 #undef recursive_lambda
22342 #undef get_recursive_lambda_caller
22343 #undef lambda
22344 #undef lambda_with_catch
22345 #undef self_recursion
22346 #undef lambda_RLSRRS
22347
22348 #undef MAGIC
22349
22350 #undef nothing
22351
22352 #undef elseif
22353 #undef _big_than_
22354 #undef _small_than_
22355
22356 #if defined(_MSC_VER)
22357 #undef not
22358 #undef and
22359 #undef or
22360 #endif
22361
22362 #undef INTER_NAMESPACE
22363 #undef BREAK_NAMESPACE
22364
22365 #undef szie
22366 #undef form
22367
22368 #undef template_name
22369 #undef type_name
22370
22371 #undef not_in_debug
22372
22373 #undef es
22374 #undef ec
22375
22376 #undef ELC_TEST_EVENTNAME
22377
22378 #undef override_instance_struct
22379
22380 #undef distinctive
22381
22382 #undef force_inline
22383
22384 #undef with_no_vtable
22385
22386 #undef in_consteval
22387
22388 #undef no_vtable_struct
22389 #undef no_vtable_class
22390
22391 //file_end
22392
22393 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22394
22395 //file_end
22396
22397 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22398 }
22399 namespace elc{
22400 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_export.hpp"
22401 //_export.hpp
22402 //at namespace elc
22403 /*
22404 未完成的elc解释器literal文件
22405 由steve02081504与Alex0125设计、编写
22406 转载时请在不对此文件做任何修改的同时注明出处
22407 项目地址:https://github.com/steve02081504/ELC
22408 */
22409 #define export using ::
22410 #undef export
22411
22412 //file_end
22413
22414 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22415 }
22416
22417 //file_end
22418
22419 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/literal"
22420 #endif
22421
22422 //file_end
22423
22424 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
22425 //#include "log"
22426 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/memory_stream"
22427 //memory_stream
22428 //at namespace ::
22429 /*
22430 未完成的elc解释器include文件
22431 由steve02081504与Alex0125设计、编写
22432 转载时请在不对此文件做任何修改的同时注明出处
22433 项目地址:https://github.com/steve02081504/ELC
22434 */
22435 #if !defined(ELC_MEMORY_STREAM)
22436 #define ELC_MEMORY_STREAM
22437 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22438 //_body.hpp
22439 //at namespace ::
22440 /*
22441 未完成的elc解释器memory_stream文件
22442 由steve02081504与Alex0125设计、编写
22443 转载时请在不对此文件做任何修改的同时注明出处
22444 项目地址:https://github.com/steve02081504/ELC
22445 */
22446 #if defined(ELC_TEST)
22447 #error "this part cannot be tested."
22448 #endif
22449 namespace elc::defs{
22450 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
22451 //_defs.hpp
22452 /*
22453 未完成的elc解释器basic文件
22454 由steve02081504与Alex0125设计、编写
22455 转载时请在不对此文件做任何修改的同时注明出处
22456 项目地址:https://github.com/steve02081504/ELC
22457 */
22458 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22459 //_defs.hpp
22460 /*
22461 未完成的elc解释器_share文件
22462 由steve02081504与Alex0125设计、编写
22463 转载时请在不对此文件做任何修改的同时注明出处
22464 项目地址:https://github.com/steve02081504/ELC
22465 */
22466
22467 //undefs at "_undefs.hpp"
22468
22469 //set ELC_WARNING_LEVEL default to 4(max)
22470 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22471
22472 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
22473 //basic_environment.hpp
22474 /*
22475 未完成的elc解释器_share文件
22476 由steve02081504与Alex0125设计、编写
22477 转载时请在不对此文件做任何修改的同时注明出处
22478 项目地址:https://github.com/steve02081504/ELC
22479 */
22480
22481 //每个bit(不是字节)的可能性
22482 //为什么c艹委员会不定义这个?
22483 #define BIT_POSSIBILITY 2
22484
22485 //file_end
22486
22487 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22488
22489 #if defined(_MSC_VER)
22490 #pragma warning(push,ELC_WARNING_LEVEL)
22491 #pragma warning(disable:4099)//class与struct混用警告diss
22492 #pragma warning(disable:26812)//enum class安利diss.
22493 #pragma warning(disable:4584)//重复子类警告diss
22494 #pragma warning(disable:4250)//域控制继承警告diss
22495 #pragma warning(disable:26432)//不完全默认方法警告diss
22496 #pragma warning(disable:26435)//virtual override方法警告diss
22497 #pragma warning(disable:26481)//容器安利diss
22498 #pragma warning(disable:26446)//gsl::at安利diss
22499 #pragma warning(disable:26434)//方法覆盖警告diss
22500 #pragma warning(disable:26429)//gsl::not_null安利diss
22501 #pragma warning(disable:26471)//对void*进行static_cast安利diss
22502 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
22503 #pragma warning(disable:26473)//相同指针显式cast警告diss
22504 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
22505 #pragma warning(disable:26485)//数组作指针警告diss
22506 #pragma warning(disable:26490)//reinterpret_cast警告diss
22507 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
22508 #pragma warning(disable:26482)//非常数数组索引警告diss
22509 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
22510 #endif
22511 #if defined(_MSC_VER)
22512 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
22513 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
22514 #define push_msvc_warning() __pragma(warning(push))
22515 #define pop_msvc_warning() __pragma(warning(pop))
22516 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
22517 #else
22518 #define suppress_msvc_warning(...)
22519 #define disable_msvc_warning(...)
22520 #define push_msvc_warning()
22521 #define pop_msvc_warning()
22522 #define push_and_disable_msvc_warning(...)
22523 #endif
22524 //
22525 #if defined(ELC_VOID_NAME)
22526 #undef void
22527 #endif
22528
22529 // #define often_noexcept
22530 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
22531 #define noexcept_as_auto MAGIC//哦现在有了
22532 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
22533 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
22534
22535 #define using_method_from_base_t(name,...) \
22536 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
22537 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
22538 {\
22539 return base_t::name(forward<Args>(rest)...);\
22540 }\
22541
22542 #define using_method_from_value(name,value_name,...) \
22543 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
22544 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
22545 {\
22546 return value_name.name(forward<Args>(rest)...);\
22547 }\
22548
22549 #define floop while(__builtin_is_my_dick_still_there())
22550 #define enable_adl(name) void name()noexcept=delete
22551
22552 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
22553 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
22554
22555 #define declvalue(...) (::std::declval<__VA_ARGS__>())
22556
22557 /*实例化到此将引发错误*/
22558 #define template_error(reason) static_assert(template_error_helper<T>,reason)
22559 /*实例化到此将引发警告*/
22560 #define template_warning(reason) template_warning_helper<T>(reason)
22561
22562 //for type_info
22563 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
22564 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
22565
22566 #define is_common_attribute(name) public attribute<T,name<T>>
22567 #define is_special_attribute(name) public attribute<T,name>
22568
22569 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
22570 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
22571
22572 //for float_size_t
22573 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
22574 //bitnum_of
22575 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
22576
22577 //for attribute
22578 #define def_common_attribute_with_nothing(name) \
22579 template<typename T>\
22580 class name{}\
22581
22582 #define def_special_attribute_with_nothing(name) \
22583 class name{}\
22584
22585 #define common_attribute_t template<class>class
22586 #define special_attribute_t class
22587
22588 /*
22589 若参数的布尔值为零,那么此模板不会实例化
22590
22591 为什么不用cpp20的constraints?
22592 1.不能类内定义
22593 2.不能作为模板参数
22594 一句话总结:c艹标准会sb
22595 */
22596 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
22597 /*默认参与模板候选*/
22598 #define enabled_by_default class enable_state=void
22599 /*默认不参与模板候选*/
22600 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
22601 /*若参数为病式,那么此模板不会实例化*/
22602 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
22603 /*用于模板声明*/
22604 #define enable_flag class enable_state
22605
22606 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
22607 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
22608 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
22609 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
22610 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
22611
22612 /*让lambda递归更加美观*/
22613 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
22614 /*让lambda递归更加美观*/
22615 #define get_recursive_lambda_caller(name) \
22616 lambda_with_catch(&)(auto&&...Args){\
22617 return name(name,Args...);\
22618 }
22619 /*让lambda定义更加美观*/
22620 #define lambda []
22621 /*让lambda定义更加美观*/
22622 #define lambda_with_catch(...) [__VA_ARGS__]
22623 /*让lambda递归更加美观*/
22624 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
22625 //recursive_lambda_self_referential_reserved_symbolname
22626 #define lambda_RLSRRS _my_jb_super_sb_name_
22627
22628 #define MAGIC//ahh,ko no tenno da!
22629
22630 /*装饰性语法糖*/
22631 #define nothing
22632
22633 /*aya风格语法糖*/
22634 #define elseif else if
22635 /*aya风格语法糖*/
22636 #define _big_than_ >
22637 /*aya风格语法糖*/
22638 #define _small_than_ <
22639
22640 #if defined(_MSC_VER)
22641 #define not !
22642 #define and &&
22643 #define or ||
22644 #endif
22645
22646 /*进入名称空间,并不是很美观*/
22647 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
22648 /*退出名称空间,并不是很美观*/
22649 #define BREAK_NAMESPACE }
22650
22651 /*template说明符*/
22652 #define template_name template
22653 /*template说明符*/
22654 #define type_name class
22655
22656 #if defined(DEBUG) || defined(_DEBUG)
22657 #define not_in_debug 0
22658 #else
22659 #define not_in_debug 1
22660 #endif
22661
22662 #define es U""
22663 #define ec(ch) U ## ch
22664
22665 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
22666 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
22667 #else
22668 #define ELC_TEST_EVENTNAME(name)
22669 #endif
22670
22671 #define override_instance_struct \
22672 protected:\
22673 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
22674 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
22675 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
22676 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
22677 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
22678
22679 #if defined(_WIN32)
22680 #define distinctive __declspec(dllexport)
22681 #else
22682 #define distinctive
22683 #endif
22684
22685 #if defined(_WIN32)
22686 #define force_inline __forceinline
22687 #elif defined(__GNUC__)
22688 #define force_inline __attribute__((always_inline)) inline
22689 #else
22690 #define force_inline inline
22691 #endif
22692
22693 #if defined(_WIN32)
22694 #define with_no_vtable __declspec(novtable)
22695 #else
22696 #define with_no_vtable
22697 #endif
22698
22699 #define in_consteval (::std::is_constant_evaluated())
22700
22701 #define no_vtable_struct struct with_no_vtable
22702 #define no_vtable_class class with_no_vtable
22703
22704 //file_end
22705
22706 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
22707
22708 //file_end
22709
22710 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22711
22712 namespace stream_n{
22713 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/memory_stream.hpp"
22714 //memory_stream.hpp
22715 //at namespace elc::defs
22716 /*
22717 未完成的elc解释器memory_stream文件
22718 由steve02081504与Alex0125设计、编写
22719 转载时请在不对此文件做任何修改的同时注明出处
22720 项目地址:https://github.com/steve02081504/ELC
22721 */
22723 byte* _m;
22724 size_t _s;
22725 size_t _pos;
22726 memory_stream()noexcept{
22727 _m = get<byte>[1024]();
22728 _pos = 0;
22729 _s = 0;
22730 }
22732 unget(_m);
22733 }
22734 [[nodiscard]]size_t bufsize()const noexcept{
22735 return get_size_of_get(_m);
22736 }
22737 virtual void* seek(seek_type st,int_t offsize)noexcept override{
22738 switch(st){
22739 case beg:
22740 _pos = 0;
22741 return _m;
22742 case cur:
22743 _pos += (ptrdiff_t)offsize;
22744 return _m + _pos;
22745 case end:
22746 _pos = _s;
22747 return _m+_pos;
22748 default:
22749 return nullptr;
22750 }
22751 }
22752 virtual void seek_to(void*p)noexcept override{
22753 _pos = ((byte*)p)-_m;
22754 }
22755 virtual void sync()noexcept override{
22756 //do nothing
22757 }
22758 virtual void flush()noexcept override{
22759 //do nothing
22760 }
22761 virtual void close()noexcept override{
22762 unget(_m);
22763 _m = nullptr;
22764 _s = 0;
22765 }
22766 virtual void write(const byte*buf,size_t size)noexcept override{
22767 if(size>this->bufsize()-_pos)
22768 get_resize(_m,get_next_gold_size_to_resize_for_array(_pos+size));
22769 ::std::memcpy(_m+_pos,buf,size);
22770 _pos += size;
22771 _s = max(_pos,_s);
22772 }
22773 virtual size_t read(byte*buf,size_t size)noexcept override{
22774 if(_pos+size>_s)
22775 size = _s-_pos;
22776 ::std::memcpy(buf,_m+_pos,size);
22777 _pos += size;
22778 return size;
22779 }
22780 };
22781
22782 //file_end
22783
22784 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22785 }
22786
22787 #if defined(ELC_TEST_ON)
22788 namespace memory_stream_part_test{
22789 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_test.hpp"
22790 //_test.hpp
22791 /*
22792 未完成的elc解释器memory_stream文件
22793 由steve02081504与Alex0125设计、编写
22794 转载时请在不对此文件做任何修改的同时注明出处
22795 项目地址:https://github.com/steve02081504/ELC
22796 */
22797 inline void test(){
22798 ELC_TEST_EVENTNAME("memory_stream部分测试");
22799 }
22800 inline void test_log_out(){
22801 }
22802 inline void test_end(){
22803 }
22804
22805 //file_end
22806
22807 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22808 }
22809 #endif
22810
22811 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22812 //_undefs.hpp
22813 /*
22814 未完成的elc解释器basic文件
22815 由steve02081504与Alex0125设计、编写
22816 转载时请在不对此文件做任何修改的同时注明出处
22817 项目地址:https://github.com/steve02081504/ELC
22818 */
22819 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
22820 //_undefs.hpp
22821 /*
22822 未完成的elc解释器_share文件
22823 由steve02081504与Alex0125设计、编写
22824 转载时请在不对此文件做任何修改的同时注明出处
22825 项目地址:https://github.com/steve02081504/ELC
22826 */
22827
22828 //defs at "_defs.hpp"
22829
22830 #if defined(_MSC_VER)
22831 #pragma warning(pop)
22832 #endif
22833 #undef suppress_msvc_warning
22834 #undef disable_msvc_warning
22835 #undef push_msvc_warning
22836 #undef pop_msvc_warning
22837 #undef push_and_disable_msvc_warning
22838
22839 //for basic_environment.hpp
22840 #undef BIT_POSSIBILITY
22841 //
22842 #if defined(ELC_VOID_NAME)
22843 #define void the_void
22844 #endif
22845
22846 // #undef often_noexcept
22847 #undef noexcept_as
22848 #undef noexcept_as_auto
22849 #undef constexpr_as
22850 #undef constexpr_as_auto
22851
22852 #undef using_method_from_base_t
22853 #undef using_method_from_value
22854
22855 #undef floop
22856 #undef enable_adl
22857
22858 #undef re_declvalue
22859 #undef re_decltype
22860
22861 #undef declvalue
22862
22863 #undef template_error
22864 #undef template_warning
22865
22866 #undef type_info_of
22867 #undef type_name_of
22868
22869 #undef is_common_attribute
22870 #undef is_special_attribute
22871
22872 #undef has_attribute
22873 #undef not_has_attribute
22874
22875 #undef float_size_of
22876 #undef bitnum_of
22877
22878 #undef def_common_attribute_with_nothing
22879 #undef def_special_attribute_with_nothing
22880
22881 #undef common_attribute_t
22882 #undef special_attribute_t
22883
22884 #undef enable_if
22885 #undef enabled_by_default
22886 #undef disabled_by_default
22887 #undef enable_if_not_ill_form
22888 #undef enable_flag
22889
22890 #undef was_an_ill_form
22891 #undef was_an_ill_form_with_parameter
22892 #undef was_not_an_ill_form
22893 #undef was_not_an_ill_form_and_noexcept
22894 #undef was_not_an_ill_form_with_parameter
22895
22896 #undef recursive_lambda
22897 #undef get_recursive_lambda_caller
22898 #undef lambda
22899 #undef lambda_with_catch
22900 #undef self_recursion
22901 #undef lambda_RLSRRS
22902
22903 #undef MAGIC
22904
22905 #undef nothing
22906
22907 #undef elseif
22908 #undef _big_than_
22909 #undef _small_than_
22910
22911 #if defined(_MSC_VER)
22912 #undef not
22913 #undef and
22914 #undef or
22915 #endif
22916
22917 #undef INTER_NAMESPACE
22918 #undef BREAK_NAMESPACE
22919
22920 #undef szie
22921 #undef form
22922
22923 #undef template_name
22924 #undef type_name
22925
22926 #undef not_in_debug
22927
22928 #undef es
22929 #undef ec
22930
22931 #undef ELC_TEST_EVENTNAME
22932
22933 #undef override_instance_struct
22934
22935 #undef distinctive
22936
22937 #undef force_inline
22938
22939 #undef with_no_vtable
22940
22941 #undef in_consteval
22942
22943 #undef no_vtable_struct
22944 #undef no_vtable_class
22945
22946 //file_end
22947
22948 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22949
22950 //file_end
22951
22952 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22953 }
22954 namespace elc{
22955 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_export.hpp"
22956 //_export.hpp
22957 //at namespace elc
22958 /*
22959 未完成的elc解释器memory_stream文件
22960 由steve02081504与Alex0125设计、编写
22961 转载时请在不对此文件做任何修改的同时注明出处
22962 项目地址:https://github.com/steve02081504/ELC
22963 */
22964 #define export using defs::
22965 export memory_stream;
22966 #undef export
22967
22968 //file_end
22969
22970 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22971 }
22972
22973 //file_end
22974
22975 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/memory_stream"
22976 #endif
22977
22978 //file_end
22979
22980 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
22981 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
22982 //namespace
22983 //at namespace ::
22984 /*
22985 未完成的elc解释器include文件
22986 由steve02081504与Alex0125设计、编写
22987 转载时请在不对此文件做任何修改的同时注明出处
22988 项目地址:https://github.com/steve02081504/ELC
22989 */
22990 #if !defined(ELC_NAMESPACE)
22991 #define ELC_NAMESPACE
22992 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
22993 //core
22994 //at namespace ::
22995 /*
22996 未完成的elc解释器include文件
22997 由steve02081504与Alex0125设计、编写
22998 转载时请在不对此文件做任何修改的同时注明出处
22999 项目地址:https://github.com/steve02081504/ELC
23000 */
23001 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
23002
23003 //file_end
23004
23005 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
23006 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23007 //string
23008 //at namespace ::
23009 /*
23010 未完成的elc解释器include文件
23011 由steve02081504与Alex0125设计、编写
23012 转载时请在不对此文件做任何修改的同时注明出处
23013 项目地址:https://github.com/steve02081504/ELC
23014 */
23015 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23016
23017 //file_end
23018
23019 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
23020 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23021 //_body.hpp
23022 //at namespace ::
23023 /*
23024 未完成的elc解释器namespace文件
23025 由steve02081504与Alex0125设计、编写
23026 转载时请在不对此文件做任何修改的同时注明出处
23027 项目地址:https://github.com/steve02081504/ELC
23028 */
23029 #if defined(ELC_TEST)
23030 #error "this part cannot be tested."
23031 #endif
23032 namespace elc::defs{
23033 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
23034 //_defs.hpp
23035 /*
23036 未完成的elc解释器basic文件
23037 由steve02081504与Alex0125设计、编写
23038 转载时请在不对此文件做任何修改的同时注明出处
23039 项目地址:https://github.com/steve02081504/ELC
23040 */
23041 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23042 //_defs.hpp
23043 /*
23044 未完成的elc解释器_share文件
23045 由steve02081504与Alex0125设计、编写
23046 转载时请在不对此文件做任何修改的同时注明出处
23047 项目地址:https://github.com/steve02081504/ELC
23048 */
23049
23050 //undefs at "_undefs.hpp"
23051
23052 //set ELC_WARNING_LEVEL default to 4(max)
23053 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23054
23055 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
23056 //basic_environment.hpp
23057 /*
23058 未完成的elc解释器_share文件
23059 由steve02081504与Alex0125设计、编写
23060 转载时请在不对此文件做任何修改的同时注明出处
23061 项目地址:https://github.com/steve02081504/ELC
23062 */
23063
23064 //每个bit(不是字节)的可能性
23065 //为什么c艹委员会不定义这个?
23066 #define BIT_POSSIBILITY 2
23067
23068 //file_end
23069
23070 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23071
23072 #if defined(_MSC_VER)
23073 #pragma warning(push,ELC_WARNING_LEVEL)
23074 #pragma warning(disable:4099)//class与struct混用警告diss
23075 #pragma warning(disable:26812)//enum class安利diss.
23076 #pragma warning(disable:4584)//重复子类警告diss
23077 #pragma warning(disable:4250)//域控制继承警告diss
23078 #pragma warning(disable:26432)//不完全默认方法警告diss
23079 #pragma warning(disable:26435)//virtual override方法警告diss
23080 #pragma warning(disable:26481)//容器安利diss
23081 #pragma warning(disable:26446)//gsl::at安利diss
23082 #pragma warning(disable:26434)//方法覆盖警告diss
23083 #pragma warning(disable:26429)//gsl::not_null安利diss
23084 #pragma warning(disable:26471)//对void*进行static_cast安利diss
23085 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
23086 #pragma warning(disable:26473)//相同指针显式cast警告diss
23087 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
23088 #pragma warning(disable:26485)//数组作指针警告diss
23089 #pragma warning(disable:26490)//reinterpret_cast警告diss
23090 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
23091 #pragma warning(disable:26482)//非常数数组索引警告diss
23092 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
23093 #endif
23094 #if defined(_MSC_VER)
23095 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
23096 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
23097 #define push_msvc_warning() __pragma(warning(push))
23098 #define pop_msvc_warning() __pragma(warning(pop))
23099 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
23100 #else
23101 #define suppress_msvc_warning(...)
23102 #define disable_msvc_warning(...)
23103 #define push_msvc_warning()
23104 #define pop_msvc_warning()
23105 #define push_and_disable_msvc_warning(...)
23106 #endif
23107 //
23108 #if defined(ELC_VOID_NAME)
23109 #undef void
23110 #endif
23111
23112 // #define often_noexcept
23113 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
23114 #define noexcept_as_auto MAGIC//哦现在有了
23115 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
23116 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
23117
23118 #define using_method_from_base_t(name,...) \
23119 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
23120 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
23121 {\
23122 return base_t::name(forward<Args>(rest)...);\
23123 }\
23124
23125 #define using_method_from_value(name,value_name,...) \
23126 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
23127 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
23128 {\
23129 return value_name.name(forward<Args>(rest)...);\
23130 }\
23131
23132 #define floop while(__builtin_is_my_dick_still_there())
23133 #define enable_adl(name) void name()noexcept=delete
23134
23135 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
23136 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
23137
23138 #define declvalue(...) (::std::declval<__VA_ARGS__>())
23139
23140 /*实例化到此将引发错误*/
23141 #define template_error(reason) static_assert(template_error_helper<T>,reason)
23142 /*实例化到此将引发警告*/
23143 #define template_warning(reason) template_warning_helper<T>(reason)
23144
23145 //for type_info
23146 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
23147 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
23148
23149 #define is_common_attribute(name) public attribute<T,name<T>>
23150 #define is_special_attribute(name) public attribute<T,name>
23151
23152 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
23153 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
23154
23155 //for float_size_t
23156 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
23157 //bitnum_of
23158 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
23159
23160 //for attribute
23161 #define def_common_attribute_with_nothing(name) \
23162 template<typename T>\
23163 class name{}\
23164
23165 #define def_special_attribute_with_nothing(name) \
23166 class name{}\
23167
23168 #define common_attribute_t template<class>class
23169 #define special_attribute_t class
23170
23171 /*
23172 若参数的布尔值为零,那么此模板不会实例化
23173
23174 为什么不用cpp20的constraints?
23175 1.不能类内定义
23176 2.不能作为模板参数
23177 一句话总结:c艹标准会sb
23178 */
23179 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
23180 /*默认参与模板候选*/
23181 #define enabled_by_default class enable_state=void
23182 /*默认不参与模板候选*/
23183 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
23184 /*若参数为病式,那么此模板不会实例化*/
23185 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
23186 /*用于模板声明*/
23187 #define enable_flag class enable_state
23188
23189 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
23190 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
23191 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
23192 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
23193 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
23194
23195 /*让lambda递归更加美观*/
23196 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
23197 /*让lambda递归更加美观*/
23198 #define get_recursive_lambda_caller(name) \
23199 lambda_with_catch(&)(auto&&...Args){\
23200 return name(name,Args...);\
23201 }
23202 /*让lambda定义更加美观*/
23203 #define lambda []
23204 /*让lambda定义更加美观*/
23205 #define lambda_with_catch(...) [__VA_ARGS__]
23206 /*让lambda递归更加美观*/
23207 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
23208 //recursive_lambda_self_referential_reserved_symbolname
23209 #define lambda_RLSRRS _my_jb_super_sb_name_
23210
23211 #define MAGIC//ahh,ko no tenno da!
23212
23213 /*装饰性语法糖*/
23214 #define nothing
23215
23216 /*aya风格语法糖*/
23217 #define elseif else if
23218 /*aya风格语法糖*/
23219 #define _big_than_ >
23220 /*aya风格语法糖*/
23221 #define _small_than_ <
23222
23223 #if defined(_MSC_VER)
23224 #define not !
23225 #define and &&
23226 #define or ||
23227 #endif
23228
23229 /*进入名称空间,并不是很美观*/
23230 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
23231 /*退出名称空间,并不是很美观*/
23232 #define BREAK_NAMESPACE }
23233
23234 /*template说明符*/
23235 #define template_name template
23236 /*template说明符*/
23237 #define type_name class
23238
23239 #if defined(DEBUG) || defined(_DEBUG)
23240 #define not_in_debug 0
23241 #else
23242 #define not_in_debug 1
23243 #endif
23244
23245 #define es U""
23246 #define ec(ch) U ## ch
23247
23248 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
23249 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
23250 #else
23251 #define ELC_TEST_EVENTNAME(name)
23252 #endif
23253
23254 #define override_instance_struct \
23255 protected:\
23256 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
23257 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
23258 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
23259 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
23260 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
23261
23262 #if defined(_WIN32)
23263 #define distinctive __declspec(dllexport)
23264 #else
23265 #define distinctive
23266 #endif
23267
23268 #if defined(_WIN32)
23269 #define force_inline __forceinline
23270 #elif defined(__GNUC__)
23271 #define force_inline __attribute__((always_inline)) inline
23272 #else
23273 #define force_inline inline
23274 #endif
23275
23276 #if defined(_WIN32)
23277 #define with_no_vtable __declspec(novtable)
23278 #else
23279 #define with_no_vtable
23280 #endif
23281
23282 #define in_consteval (::std::is_constant_evaluated())
23283
23284 #define no_vtable_struct struct with_no_vtable
23285 #define no_vtable_class class with_no_vtable
23286
23287 //file_end
23288
23289 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
23290
23291 //file_end
23292
23293 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23294
23295 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/defs.hpp"
23296 //defs.hpp
23297 /*
23298 未完成的elc解释器namespace文件
23299 由steve02081504与Alex0125设计、编写
23300 转载时请在不对此文件做任何修改的同时注明出处
23301 项目地址:https://github.com/steve02081504/ELC
23302 */
23303 namespace core{
23304 template<>
23305 distinctive inline map_t<ptr,string> long_term_binary_node_storager<string>{};
23306 }
23307 namespace namespace_n{
23311 value get_symbol_type_map(ptr thenamespace){
23312 return (*thenamespace)[es".symbol_type_map"];
23313 }
23314 namespace_t()noexcept{
23315 _namespace_root = get<common_node>();
23316 auto&nmsp = *_namespace_root;
23317 _namespace_now = &nmsp;
23318 push_and_disable_msvc_warning(26447);//may throw警告diss
23319 nmsp[es".."] = the_void;
23320 nmsp[es"."] = nmsp;
23321 nmsp[es"t"] = t;
23322 nmsp[es"nil"] = nil;
23323 nmsp[es"void"] = the_void;
23324 value nmsptm = get_symbol_type_map(&nmsp);
23325 nmsptm = get<common_node>();
23326 nmsptm[es"void"] = es"void";
23328 }
23329 ptr get_symbol_namespace(const value index){
23330 ptr namespace_now_p = _namespace_now;
23331 while(namespace_now_p && !(*namespace_now_p)[index] && !get_symbol_type_map(namespace_now_p)[index])
23332 namespace_now_p = (*namespace_now_p)[es".."];
23333 return namespace_now_p;
23334 }
23335 ptr get_symbol_namespace(auto&& index){ return get_symbol_namespace(as_value(index)); }
23336 bool has_symbol(const value index){
23337 auto nmsp=get_symbol_namespace(index);
23338 if((*nmsp)[index] || get_symbol_type_map(nmsp)[index])
23339 return true;
23340 return false;
23341 }
23342 bool has_symbol(auto&& index){ return has_symbol(as_value(index)); }
23343 value get_symbol(const value index){
23344 return (*get_symbol_namespace(index))[index];
23345 }
23346 value get_symbol(auto&& index){ return get_symbol(as_value(index)); }
23347 value get_symbol_type(const value index){
23348 return get_symbol_type_map(get_symbol_namespace(index))[index];
23349 }
23350 value get_symbol_type(auto&& index){ return get_symbol_type(as_value(index)); }
23351
23352 void inter_namespace(const value namespace_name){
23353 _namespace_now = get_symbol(namespace_name);
23354 }
23355 void inter_namespace(auto&& index){ inter_namespace(as_value(index)); }
23356
23357 void leave_namespace(){ inter_namespace(es".."); }
23358 }names{};
23359 }
23360
23361 //file_end
23362
23363 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23364
23365 #if defined(ELC_TEST_ON)
23366 namespace namespace_part_test{
23367 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_test.hpp"
23368 //_test.hpp
23369 /*
23370 未完成的elc解释器namespace文件
23371 由steve02081504与Alex0125设计、编写
23372 转载时请在不对此文件做任何修改的同时注明出处
23373 项目地址:https://github.com/steve02081504/ELC
23374 */
23375 inline void test(){
23376 ELC_TEST_EVENTNAME("namespace部分测试");
23377 }
23378 inline void test_log_out(){
23379 }
23380 inline void test_end{
23381 }
23382
23383 //file_end
23384
23385 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23386 }
23387 #endif
23388
23389 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
23390 //_undefs.hpp
23391 /*
23392 未完成的elc解释器basic文件
23393 由steve02081504与Alex0125设计、编写
23394 转载时请在不对此文件做任何修改的同时注明出处
23395 项目地址:https://github.com/steve02081504/ELC
23396 */
23397 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
23398 //_undefs.hpp
23399 /*
23400 未完成的elc解释器_share文件
23401 由steve02081504与Alex0125设计、编写
23402 转载时请在不对此文件做任何修改的同时注明出处
23403 项目地址:https://github.com/steve02081504/ELC
23404 */
23405
23406 //defs at "_defs.hpp"
23407
23408 #if defined(_MSC_VER)
23409 #pragma warning(pop)
23410 #endif
23411 #undef suppress_msvc_warning
23412 #undef disable_msvc_warning
23413 #undef push_msvc_warning
23414 #undef pop_msvc_warning
23415 #undef push_and_disable_msvc_warning
23416
23417 //for basic_environment.hpp
23418 #undef BIT_POSSIBILITY
23419 //
23420 #if defined(ELC_VOID_NAME)
23421 #define void the_void
23422 #endif
23423
23424 // #undef often_noexcept
23425 #undef noexcept_as
23426 #undef noexcept_as_auto
23427 #undef constexpr_as
23428 #undef constexpr_as_auto
23429
23430 #undef using_method_from_base_t
23431 #undef using_method_from_value
23432
23433 #undef floop
23434 #undef enable_adl
23435
23436 #undef re_declvalue
23437 #undef re_decltype
23438
23439 #undef declvalue
23440
23441 #undef template_error
23442 #undef template_warning
23443
23444 #undef type_info_of
23445 #undef type_name_of
23446
23447 #undef is_common_attribute
23448 #undef is_special_attribute
23449
23450 #undef has_attribute
23451 #undef not_has_attribute
23452
23453 #undef float_size_of
23454 #undef bitnum_of
23455
23456 #undef def_common_attribute_with_nothing
23457 #undef def_special_attribute_with_nothing
23458
23459 #undef common_attribute_t
23460 #undef special_attribute_t
23461
23462 #undef enable_if
23463 #undef enabled_by_default
23464 #undef disabled_by_default
23465 #undef enable_if_not_ill_form
23466 #undef enable_flag
23467
23468 #undef was_an_ill_form
23469 #undef was_an_ill_form_with_parameter
23470 #undef was_not_an_ill_form
23471 #undef was_not_an_ill_form_and_noexcept
23472 #undef was_not_an_ill_form_with_parameter
23473
23474 #undef recursive_lambda
23475 #undef get_recursive_lambda_caller
23476 #undef lambda
23477 #undef lambda_with_catch
23478 #undef self_recursion
23479 #undef lambda_RLSRRS
23480
23481 #undef MAGIC
23482
23483 #undef nothing
23484
23485 #undef elseif
23486 #undef _big_than_
23487 #undef _small_than_
23488
23489 #if defined(_MSC_VER)
23490 #undef not
23491 #undef and
23492 #undef or
23493 #endif
23494
23495 #undef INTER_NAMESPACE
23496 #undef BREAK_NAMESPACE
23497
23498 #undef szie
23499 #undef form
23500
23501 #undef template_name
23502 #undef type_name
23503
23504 #undef not_in_debug
23505
23506 #undef es
23507 #undef ec
23508
23509 #undef ELC_TEST_EVENTNAME
23510
23511 #undef override_instance_struct
23512
23513 #undef distinctive
23514
23515 #undef force_inline
23516
23517 #undef with_no_vtable
23518
23519 #undef in_consteval
23520
23521 #undef no_vtable_struct
23522 #undef no_vtable_class
23523
23524 //file_end
23525
23526 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
23527
23528 //file_end
23529
23530 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23531 }
23532 namespace elc{
23533 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_export.hpp"
23534 //_export.hpp
23535 //at namespace elc
23536 /*
23537 未完成的elc解释器namespace文件
23538 由steve02081504与Alex0125设计、编写
23539 转载时请在不对此文件做任何修改的同时注明出处
23540 项目地址:https://github.com/steve02081504/ELC
23541 */
23542 #define export using defs::
23543 export namespace_n::names;
23544 #undef export
23545
23546 //file_end
23547
23548 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23549 }
23550
23551 //file_end
23552
23553 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
23554 #endif
23555
23556 //file_end
23557
23558 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
23559 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
23560 //numerical_representation
23561 //at namespace ::
23562 /*
23563 未完成的elc解释器include文件
23564 由steve02081504与Alex0125设计、编写
23565 转载时请在不对此文件做任何修改的同时注明出处
23566 项目地址:https://github.com/steve02081504/ELC
23567 */
23568 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
23569
23570 //file_end
23571
23572 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
23573 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23574 //lib_loader
23575 //at namespace ::
23576 /*
23577 未完成的elc解释器include文件
23578 由steve02081504与Alex0125设计、编写
23579 转载时请在不对此文件做任何修改的同时注明出处
23580 项目地址:https://github.com/steve02081504/ELC
23581 */
23582 #if !defined(ELC_PACKAGE_SYMBOL_LOADER)
23583 #define ELC_PACKAGE_SYMBOL_LOADER
23584 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
23585 //core
23586 //at namespace ::
23587 /*
23588 未完成的elc解释器include文件
23589 由steve02081504与Alex0125设计、编写
23590 转载时请在不对此文件做任何修改的同时注明出处
23591 项目地址:https://github.com/steve02081504/ELC
23592 */
23593 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
23594
23595 //file_end
23596
23597 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23598 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23599 //string
23600 //at namespace ::
23601 /*
23602 未完成的elc解释器include文件
23603 由steve02081504与Alex0125设计、编写
23604 转载时请在不对此文件做任何修改的同时注明出处
23605 项目地址:https://github.com/steve02081504/ELC
23606 */
23607 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23608
23609 //file_end
23610
23611 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23612 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
23613 //lib_loader
23614 //at namespace ::
23615 /*
23616 未完成的elc解释器include文件
23617 由steve02081504与Alex0125设计、编写
23618 转载时请在不对此文件做任何修改的同时注明出处
23619 项目地址:https://github.com/steve02081504/ELC
23620 */
23621 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
23622
23623 //file_end
23624
23625 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23626 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
23627 //_body.hpp
23628 //at namespace ::
23629 /*
23630 未完成的elc解释器template文件
23631 由steve02081504与Alex0125设计、编写
23632 转载时请在不对此文件做任何修改的同时注明出处
23633 项目地址:https://github.com/steve02081504/ELC
23634 */
23635 #if defined(ELC_TEST)
23636 #error "this part cannot be tested."
23637 #endif
23638 //include locale:自然语言相关的字符串
23639 //strings
23640 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
23641 //using.hpp
23642 /*
23643 未完成的elc解释器_share文件
23644 由steve02081504与Alex0125设计、编写
23645 转载时请在不对此文件做任何修改的同时注明出处
23646 项目地址:https://github.com/steve02081504/ELC
23647 */
23648 /*
23649 locale说明
23650 elc使用的字符串.
23651 调整这些,实现快速本地化.
23652 */
23653 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
23654
23655 //file_end
23656
23657 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
23658 //include paths:获取package_symbol_loader的实际位置
23659 //package_symbol_loader_path
23660 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23661 //paths.hpp
23662 /*
23663 未完成的elc解释器_share文件
23664 由steve02081504与Alex0125设计、编写
23665 转载时请在不对此文件做任何修改的同时注明出处
23666 项目地址:https://github.com/steve02081504/ELC
23667 */
23668 #if !defined(ELC_PATHS)
23669 #define ELC_PATHS
23670 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
23671 //base_defs
23672 //at namespace ::
23673 /*
23674 未完成的elc解释器include文件
23675 由steve02081504与Alex0125设计、编写
23676 转载时请在不对此文件做任何修改的同时注明出处
23677 项目地址:https://github.com/steve02081504/ELC
23678 */
23679 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
23680
23681 //file_end
23682
23683 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23684 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23685 //string
23686 //at namespace ::
23687 /*
23688 未完成的elc解释器include文件
23689 由steve02081504与Alex0125设计、编写
23690 转载时请在不对此文件做任何修改的同时注明出处
23691 项目地址:https://github.com/steve02081504/ELC
23692 */
23693 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23694
23695 //file_end
23696
23697 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23698 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
23699 //str_code_convert.hpp
23700 /*
23701 未完成的elc解释器_share文件
23702 由steve02081504与Alex0125设计、编写
23703 转载时请在不对此文件做任何修改的同时注明出处
23704 项目地址:https://github.com/steve02081504/ELC
23705 */
23706 /*
23707 APIs说明
23708 elc依赖的基础函数.
23709 调整这些,实现快速移植,快速优化与行为自定义.
23710 */
23711 #line 70 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
23712
23713 //file_end
23714
23715 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23716 //
23717 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/decl_system_type.hpp"
23718 //decl_system_type.hpp
23719 /*
23720 未完成的elc解释器_share文件
23721 由steve02081504与Alex0125设计、编写
23722 转载时请在不对此文件做任何修改的同时注明出处
23723 项目地址:https://github.com/steve02081504/ELC
23724 */
23725 //copy&rewrite from steve02081504/steve.h
23726 #define linux 2
23727 #define windows 3
23728 #define other 4
23729 #if defined(__linux)||defined(__linux__)||defined(__gnu_linux__)
23730 #define SYSTEM_TYPE linux
23731 #elif defined(_WIN32)||defined(__MINGW32__)||defined(__CYGWIN__)
23732 #define SYSTEM_TYPE windows
23733 #else
23734 #define SYSTEM_TYPE other
23735 #endif
23736 #define ERROR_MSG_UNABLE_OS "Unable OS,edit this file on your own or contact ELC's producers."
23737
23738 //file_end
23739
23740 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23741 //
23742 #if SYSTEM_TYPE == windows
23743 #include <shlobj_core.h>
23744 #elif SYSTEM_TYPE == linux
23745 #include <unistd.h>
23746 #else
23747 #include <cstdio>
23748 #endif
23749 //
23750 namespace elc::paths{
23751 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23752 //_defs.hpp
23753 /*
23754 未完成的elc解释器_share文件
23755 由steve02081504与Alex0125设计、编写
23756 转载时请在不对此文件做任何修改的同时注明出处
23757 项目地址:https://github.com/steve02081504/ELC
23758 */
23759
23760 //undefs at "_undefs.hpp"
23761
23762 //set ELC_WARNING_LEVEL default to 4(max)
23763 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23764
23765 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
23766 //basic_environment.hpp
23767 /*
23768 未完成的elc解释器_share文件
23769 由steve02081504与Alex0125设计、编写
23770 转载时请在不对此文件做任何修改的同时注明出处
23771 项目地址:https://github.com/steve02081504/ELC
23772 */
23773
23774 //每个bit(不是字节)的可能性
23775 //为什么c艹委员会不定义这个?
23776 #define BIT_POSSIBILITY 2
23777
23778 //file_end
23779
23780 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23781
23782 #if defined(_MSC_VER)
23783 #pragma warning(push,ELC_WARNING_LEVEL)
23784 #pragma warning(disable:4099)//class与struct混用警告diss
23785 #pragma warning(disable:26812)//enum class安利diss.
23786 #pragma warning(disable:4584)//重复子类警告diss
23787 #pragma warning(disable:4250)//域控制继承警告diss
23788 #pragma warning(disable:26432)//不完全默认方法警告diss
23789 #pragma warning(disable:26435)//virtual override方法警告diss
23790 #pragma warning(disable:26481)//容器安利diss
23791 #pragma warning(disable:26446)//gsl::at安利diss
23792 #pragma warning(disable:26434)//方法覆盖警告diss
23793 #pragma warning(disable:26429)//gsl::not_null安利diss
23794 #pragma warning(disable:26471)//对void*进行static_cast安利diss
23795 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
23796 #pragma warning(disable:26473)//相同指针显式cast警告diss
23797 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
23798 #pragma warning(disable:26485)//数组作指针警告diss
23799 #pragma warning(disable:26490)//reinterpret_cast警告diss
23800 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
23801 #pragma warning(disable:26482)//非常数数组索引警告diss
23802 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
23803 #endif
23804 #if defined(_MSC_VER)
23805 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
23806 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
23807 #define push_msvc_warning() __pragma(warning(push))
23808 #define pop_msvc_warning() __pragma(warning(pop))
23809 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
23810 #else
23811 #define suppress_msvc_warning(...)
23812 #define disable_msvc_warning(...)
23813 #define push_msvc_warning()
23814 #define pop_msvc_warning()
23815 #define push_and_disable_msvc_warning(...)
23816 #endif
23817 //
23818 #if defined(ELC_VOID_NAME)
23819 #undef void
23820 #endif
23821
23822 // #define often_noexcept
23823 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
23824 #define noexcept_as_auto MAGIC//哦现在有了
23825 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
23826 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
23827
23828 #define using_method_from_base_t(name,...) \
23829 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
23830 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
23831 {\
23832 return base_t::name(forward<Args>(rest)...);\
23833 }\
23834
23835 #define using_method_from_value(name,value_name,...) \
23836 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
23837 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
23838 {\
23839 return value_name.name(forward<Args>(rest)...);\
23840 }\
23841
23842 #define floop while(__builtin_is_my_dick_still_there())
23843 #define enable_adl(name) void name()noexcept=delete
23844
23845 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
23846 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
23847
23848 #define declvalue(...) (::std::declval<__VA_ARGS__>())
23849
23850 /*实例化到此将引发错误*/
23851 #define template_error(reason) static_assert(template_error_helper<T>,reason)
23852 /*实例化到此将引发警告*/
23853 #define template_warning(reason) template_warning_helper<T>(reason)
23854
23855 //for type_info
23856 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
23857 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
23858
23859 #define is_common_attribute(name) public attribute<T,name<T>>
23860 #define is_special_attribute(name) public attribute<T,name>
23861
23862 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
23863 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
23864
23865 //for float_size_t
23866 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
23867 //bitnum_of
23868 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
23869
23870 //for attribute
23871 #define def_common_attribute_with_nothing(name) \
23872 template<typename T>\
23873 class name{}\
23874
23875 #define def_special_attribute_with_nothing(name) \
23876 class name{}\
23877
23878 #define common_attribute_t template<class>class
23879 #define special_attribute_t class
23880
23881 /*
23882 若参数的布尔值为零,那么此模板不会实例化
23883
23884 为什么不用cpp20的constraints?
23885 1.不能类内定义
23886 2.不能作为模板参数
23887 一句话总结:c艹标准会sb
23888 */
23889 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
23890 /*默认参与模板候选*/
23891 #define enabled_by_default class enable_state=void
23892 /*默认不参与模板候选*/
23893 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
23894 /*若参数为病式,那么此模板不会实例化*/
23895 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
23896 /*用于模板声明*/
23897 #define enable_flag class enable_state
23898
23899 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
23900 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
23901 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
23902 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
23903 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
23904
23905 /*让lambda递归更加美观*/
23906 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
23907 /*让lambda递归更加美观*/
23908 #define get_recursive_lambda_caller(name) \
23909 lambda_with_catch(&)(auto&&...Args){\
23910 return name(name,Args...);\
23911 }
23912 /*让lambda定义更加美观*/
23913 #define lambda []
23914 /*让lambda定义更加美观*/
23915 #define lambda_with_catch(...) [__VA_ARGS__]
23916 /*让lambda递归更加美观*/
23917 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
23918 //recursive_lambda_self_referential_reserved_symbolname
23919 #define lambda_RLSRRS _my_jb_super_sb_name_
23920
23921 #define MAGIC//ahh,ko no tenno da!
23922
23923 /*装饰性语法糖*/
23924 #define nothing
23925
23926 /*aya风格语法糖*/
23927 #define elseif else if
23928 /*aya风格语法糖*/
23929 #define _big_than_ >
23930 /*aya风格语法糖*/
23931 #define _small_than_ <
23932
23933 #if defined(_MSC_VER)
23934 #define not !
23935 #define and &&
23936 #define or ||
23937 #endif
23938
23939 /*进入名称空间,并不是很美观*/
23940 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
23941 /*退出名称空间,并不是很美观*/
23942 #define BREAK_NAMESPACE }
23943
23944 /*template说明符*/
23945 #define template_name template
23946 /*template说明符*/
23947 #define type_name class
23948
23949 #if defined(DEBUG) || defined(_DEBUG)
23950 #define not_in_debug 0
23951 #else
23952 #define not_in_debug 1
23953 #endif
23954
23955 #define es U""
23956 #define ec(ch) U ## ch
23957
23958 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
23959 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
23960 #else
23961 #define ELC_TEST_EVENTNAME(name)
23962 #endif
23963
23964 #define override_instance_struct \
23965 protected:\
23966 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
23967 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
23968 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
23969 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
23970 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
23971
23972 #if defined(_WIN32)
23973 #define distinctive __declspec(dllexport)
23974 #else
23975 #define distinctive
23976 #endif
23977
23978 #if defined(_WIN32)
23979 #define force_inline __forceinline
23980 #elif defined(__GNUC__)
23981 #define force_inline __attribute__((always_inline)) inline
23982 #else
23983 #define force_inline inline
23984 #endif
23985
23986 #if defined(_WIN32)
23987 #define with_no_vtable __declspec(novtable)
23988 #else
23989 #define with_no_vtable
23990 #endif
23991
23992 #define in_consteval (::std::is_constant_evaluated())
23993
23994 #define no_vtable_struct struct with_no_vtable
23995 #define no_vtable_class class with_no_vtable
23996
23997 //file_end
23998
23999 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
24000
24001 using namespace ::elc::defs;
24002 namespace defs{
24003 #if SYSTEM_TYPE == windows
24004 #define DYNAMIC_LIBRARY_SUFFIX ".dll"
24005 #else
24006 #define DYNAMIC_LIBRARY_SUFFIX ".so"
24007 #endif
24008
24009 [[nodiscard]]inline bool file_exists(const string&name)noexcept{
24010 #if SYSTEM_TYPE == windows
24011 return GetFileAttributesA(to_char_str(name).c_str())!=INVALID_FILE_ATTRIBUTES;
24012 #elif SYSTEM_TYPE == linux
24013 return access(to_char_str(name).c_str(),F_OK)==0;
24014 #else
24015 auto fp = ::std::fopen(to_char_str(name).c_str(), "rb");
24016 if(fp){
24017 ::std::fclose(fp);
24018 return true;
24019 }
24020 return false;
24021 #endif
24022 }
24023 [[nodiscard]]inline string get_program_data_path()noexcept{
24024 #if SYSTEM_TYPE == windows
24025 char path[MAX_PATH];
24026 if(!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
24027 return string{};
24028 return to_char_t_str(path);
24029 #elif SYSTEM_TYPE == linux
24030 return es"/usr/local/share"_constexpr_str;
24031 #else
24032 return string{};
24033 #endif
24034 }
24035 [[nodiscard]]inline string get_system_drive()noexcept{
24036 #if SYSTEM_TYPE == windows
24037 char path[MAX_PATH];
24038 if(!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_WINDOWS, NULL, 0, path)))
24039 return string{};
24040 return to_char_t_str(path)+es"\\.."_constexpr_str;
24041 #elif SYSTEM_TYPE == linux
24042 return es"/"_constexpr_str;
24043 #else
24044 return string{};
24045 #endif
24046 }
24047 [[nodiscard]]inline string get_elc_runtime_lib_path()noexcept{
24048 #if SYSTEM_TYPE == windows
24049 //windows: if can read file ProgramData/elc/flag , use ProgramData/elc
24050 //else try to read SystemDrive/elc/flag , use ProgramData/elc
24051 //else return "./elc"
24052 {
24053 string program_data_path=get_program_data_path();
24054 if(program_data_path.size() && file_exists(program_data_path + es"/elc/flag"_constexpr_str))
24055 return program_data_path+es"/elc"_constexpr_str;
24056 }
24057 {
24058 string system_drive=get_system_drive();
24059 if(system_drive.size() && file_exists(system_drive + es"/elc/flag"_constexpr_str))
24060 return system_drive+es"/elc"_constexpr_str;
24061 }
24062 #elif SYSTEM_TYPE == linux
24063 //linux: if can read file /usr/lib/elc/flag , use /usr/lib/elc
24064 //else return "./elc"
24065 string flag_path=es"/usr/lib/elc/flag"_constexpr_str;
24066 if(file_exists(flag_path))
24067 return es"/usr/lib/elc"_constexpr_str;
24068 #endif
24069 return es"./elc"_constexpr_str;
24070 }
24071 }
24072 inline constexpr auto package_symbol_loader_file_name = es"package_symbol_loader" DYNAMIC_LIBRARY_SUFFIX ""_constexpr_str;
24073
24074 push_and_disable_msvc_warning(26426);//动态初始化警告diss
24075 distinctive inline string elc_runtime_lib_path=defs::get_elc_runtime_lib_path();
24078
24079 #undef DYNAMIC_LIBRARY_SUFFIX
24080
24081 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
24082 //_undefs.hpp
24083 /*
24084 未完成的elc解释器_share文件
24085 由steve02081504与Alex0125设计、编写
24086 转载时请在不对此文件做任何修改的同时注明出处
24087 项目地址:https://github.com/steve02081504/ELC
24088 */
24089
24090 //defs at "_defs.hpp"
24091
24092 #if defined(_MSC_VER)
24093 #pragma warning(pop)
24094 #endif
24095 #undef suppress_msvc_warning
24096 #undef disable_msvc_warning
24097 #undef push_msvc_warning
24098 #undef pop_msvc_warning
24099 #undef push_and_disable_msvc_warning
24100
24101 //for basic_environment.hpp
24102 #undef BIT_POSSIBILITY
24103 //
24104 #if defined(ELC_VOID_NAME)
24105 #define void the_void
24106 #endif
24107
24108 // #undef often_noexcept
24109 #undef noexcept_as
24110 #undef noexcept_as_auto
24111 #undef constexpr_as
24112 #undef constexpr_as_auto
24113
24114 #undef using_method_from_base_t
24115 #undef using_method_from_value
24116
24117 #undef floop
24118 #undef enable_adl
24119
24120 #undef re_declvalue
24121 #undef re_decltype
24122
24123 #undef declvalue
24124
24125 #undef template_error
24126 #undef template_warning
24127
24128 #undef type_info_of
24129 #undef type_name_of
24130
24131 #undef is_common_attribute
24132 #undef is_special_attribute
24133
24134 #undef has_attribute
24135 #undef not_has_attribute
24136
24137 #undef float_size_of
24138 #undef bitnum_of
24139
24140 #undef def_common_attribute_with_nothing
24141 #undef def_special_attribute_with_nothing
24142
24143 #undef common_attribute_t
24144 #undef special_attribute_t
24145
24146 #undef enable_if
24147 #undef enabled_by_default
24148 #undef disabled_by_default
24149 #undef enable_if_not_ill_form
24150 #undef enable_flag
24151
24152 #undef was_an_ill_form
24153 #undef was_an_ill_form_with_parameter
24154 #undef was_not_an_ill_form
24155 #undef was_not_an_ill_form_and_noexcept
24156 #undef was_not_an_ill_form_with_parameter
24157
24158 #undef recursive_lambda
24159 #undef get_recursive_lambda_caller
24160 #undef lambda
24161 #undef lambda_with_catch
24162 #undef self_recursion
24163 #undef lambda_RLSRRS
24164
24165 #undef MAGIC
24166
24167 #undef nothing
24168
24169 #undef elseif
24170 #undef _big_than_
24171 #undef _small_than_
24172
24173 #if defined(_MSC_VER)
24174 #undef not
24175 #undef and
24176 #undef or
24177 #endif
24178
24179 #undef INTER_NAMESPACE
24180 #undef BREAK_NAMESPACE
24181
24182 #undef szie
24183 #undef form
24184
24185 #undef template_name
24186 #undef type_name
24187
24188 #undef not_in_debug
24189
24190 #undef es
24191 #undef ec
24192
24193 #undef ELC_TEST_EVENTNAME
24194
24195 #undef override_instance_struct
24196
24197 #undef distinctive
24198
24199 #undef force_inline
24200
24201 #undef with_no_vtable
24202
24203 #undef in_consteval
24204
24205 #undef no_vtable_struct
24206 #undef no_vtable_class
24207
24208 //file_end
24209
24210 #line 107 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
24211 }
24212 //
24213 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/undef_decl_system_type.hpp"
24214 //undef_decl_system_type.hpp
24215 /*
24216 未完成的elc解释器_share文件
24217 由steve02081504与Alex0125设计、编写
24218 转载时请在不对此文件做任何修改的同时注明出处
24219 项目地址:https://github.com/steve02081504/ELC
24220 */
24221 //copy&rewrite from steve02081504/evest.h
24222 #undef linux
24223 #undef windows
24224 #undef other
24225 #undef SYSTEM_TYPE
24226 #undef ERROR_MSG_UNABLE_OS
24227
24228 //file_end
24229
24230 #line 110 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
24231 #endif
24232
24233 //file_end
24234
24235 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24236 namespace elc::defs{
24237 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
24238 //_defs.hpp
24239 /*
24240 未完成的elc解释器basic文件
24241 由steve02081504与Alex0125设计、编写
24242 转载时请在不对此文件做任何修改的同时注明出处
24243 项目地址:https://github.com/steve02081504/ELC
24244 */
24245 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24246 //_defs.hpp
24247 /*
24248 未完成的elc解释器_share文件
24249 由steve02081504与Alex0125设计、编写
24250 转载时请在不对此文件做任何修改的同时注明出处
24251 项目地址:https://github.com/steve02081504/ELC
24252 */
24253
24254 //undefs at "_undefs.hpp"
24255
24256 //set ELC_WARNING_LEVEL default to 4(max)
24257 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24258
24259 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
24260 //basic_environment.hpp
24261 /*
24262 未完成的elc解释器_share文件
24263 由steve02081504与Alex0125设计、编写
24264 转载时请在不对此文件做任何修改的同时注明出处
24265 项目地址:https://github.com/steve02081504/ELC
24266 */
24267
24268 //每个bit(不是字节)的可能性
24269 //为什么c艹委员会不定义这个?
24270 #define BIT_POSSIBILITY 2
24271
24272 //file_end
24273
24274 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24275
24276 #if defined(_MSC_VER)
24277 #pragma warning(push,ELC_WARNING_LEVEL)
24278 #pragma warning(disable:4099)//class与struct混用警告diss
24279 #pragma warning(disable:26812)//enum class安利diss.
24280 #pragma warning(disable:4584)//重复子类警告diss
24281 #pragma warning(disable:4250)//域控制继承警告diss
24282 #pragma warning(disable:26432)//不完全默认方法警告diss
24283 #pragma warning(disable:26435)//virtual override方法警告diss
24284 #pragma warning(disable:26481)//容器安利diss
24285 #pragma warning(disable:26446)//gsl::at安利diss
24286 #pragma warning(disable:26434)//方法覆盖警告diss
24287 #pragma warning(disable:26429)//gsl::not_null安利diss
24288 #pragma warning(disable:26471)//对void*进行static_cast安利diss
24289 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
24290 #pragma warning(disable:26473)//相同指针显式cast警告diss
24291 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
24292 #pragma warning(disable:26485)//数组作指针警告diss
24293 #pragma warning(disable:26490)//reinterpret_cast警告diss
24294 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
24295 #pragma warning(disable:26482)//非常数数组索引警告diss
24296 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
24297 #endif
24298 #if defined(_MSC_VER)
24299 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
24300 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
24301 #define push_msvc_warning() __pragma(warning(push))
24302 #define pop_msvc_warning() __pragma(warning(pop))
24303 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
24304 #else
24305 #define suppress_msvc_warning(...)
24306 #define disable_msvc_warning(...)
24307 #define push_msvc_warning()
24308 #define pop_msvc_warning()
24309 #define push_and_disable_msvc_warning(...)
24310 #endif
24311 //
24312 #if defined(ELC_VOID_NAME)
24313 #undef void
24314 #endif
24315
24316 // #define often_noexcept
24317 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
24318 #define noexcept_as_auto MAGIC//哦现在有了
24319 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
24320 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
24321
24322 #define using_method_from_base_t(name,...) \
24323 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
24324 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
24325 {\
24326 return base_t::name(forward<Args>(rest)...);\
24327 }\
24328
24329 #define using_method_from_value(name,value_name,...) \
24330 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
24331 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
24332 {\
24333 return value_name.name(forward<Args>(rest)...);\
24334 }\
24335
24336 #define floop while(__builtin_is_my_dick_still_there())
24337 #define enable_adl(name) void name()noexcept=delete
24338
24339 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
24340 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
24341
24342 #define declvalue(...) (::std::declval<__VA_ARGS__>())
24343
24344 /*实例化到此将引发错误*/
24345 #define template_error(reason) static_assert(template_error_helper<T>,reason)
24346 /*实例化到此将引发警告*/
24347 #define template_warning(reason) template_warning_helper<T>(reason)
24348
24349 //for type_info
24350 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
24351 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
24352
24353 #define is_common_attribute(name) public attribute<T,name<T>>
24354 #define is_special_attribute(name) public attribute<T,name>
24355
24356 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
24357 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
24358
24359 //for float_size_t
24360 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
24361 //bitnum_of
24362 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
24363
24364 //for attribute
24365 #define def_common_attribute_with_nothing(name) \
24366 template<typename T>\
24367 class name{}\
24368
24369 #define def_special_attribute_with_nothing(name) \
24370 class name{}\
24371
24372 #define common_attribute_t template<class>class
24373 #define special_attribute_t class
24374
24375 /*
24376 若参数的布尔值为零,那么此模板不会实例化
24377
24378 为什么不用cpp20的constraints?
24379 1.不能类内定义
24380 2.不能作为模板参数
24381 一句话总结:c艹标准会sb
24382 */
24383 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
24384 /*默认参与模板候选*/
24385 #define enabled_by_default class enable_state=void
24386 /*默认不参与模板候选*/
24387 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
24388 /*若参数为病式,那么此模板不会实例化*/
24389 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
24390 /*用于模板声明*/
24391 #define enable_flag class enable_state
24392
24393 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
24394 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
24395 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
24396 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
24397 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
24398
24399 /*让lambda递归更加美观*/
24400 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
24401 /*让lambda递归更加美观*/
24402 #define get_recursive_lambda_caller(name) \
24403 lambda_with_catch(&)(auto&&...Args){\
24404 return name(name,Args...);\
24405 }
24406 /*让lambda定义更加美观*/
24407 #define lambda []
24408 /*让lambda定义更加美观*/
24409 #define lambda_with_catch(...) [__VA_ARGS__]
24410 /*让lambda递归更加美观*/
24411 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
24412 //recursive_lambda_self_referential_reserved_symbolname
24413 #define lambda_RLSRRS _my_jb_super_sb_name_
24414
24415 #define MAGIC//ahh,ko no tenno da!
24416
24417 /*装饰性语法糖*/
24418 #define nothing
24419
24420 /*aya风格语法糖*/
24421 #define elseif else if
24422 /*aya风格语法糖*/
24423 #define _big_than_ >
24424 /*aya风格语法糖*/
24425 #define _small_than_ <
24426
24427 #if defined(_MSC_VER)
24428 #define not !
24429 #define and &&
24430 #define or ||
24431 #endif
24432
24433 /*进入名称空间,并不是很美观*/
24434 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
24435 /*退出名称空间,并不是很美观*/
24436 #define BREAK_NAMESPACE }
24437
24438 /*template说明符*/
24439 #define template_name template
24440 /*template说明符*/
24441 #define type_name class
24442
24443 #if defined(DEBUG) || defined(_DEBUG)
24444 #define not_in_debug 0
24445 #else
24446 #define not_in_debug 1
24447 #endif
24448
24449 #define es U""
24450 #define ec(ch) U ## ch
24451
24452 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
24453 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
24454 #else
24455 #define ELC_TEST_EVENTNAME(name)
24456 #endif
24457
24458 #define override_instance_struct \
24459 protected:\
24460 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
24461 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
24462 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
24463 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
24464 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
24465
24466 #if defined(_WIN32)
24467 #define distinctive __declspec(dllexport)
24468 #else
24469 #define distinctive
24470 #endif
24471
24472 #if defined(_WIN32)
24473 #define force_inline __forceinline
24474 #elif defined(__GNUC__)
24475 #define force_inline __attribute__((always_inline)) inline
24476 #else
24477 #define force_inline inline
24478 #endif
24479
24480 #if defined(_WIN32)
24481 #define with_no_vtable __declspec(novtable)
24482 #else
24483 #define with_no_vtable
24484 #endif
24485
24486 #define in_consteval (::std::is_constant_evaluated())
24487
24488 #define no_vtable_struct struct with_no_vtable
24489 #define no_vtable_class class with_no_vtable
24490
24491 //file_end
24492
24493 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
24494
24495 //file_end
24496
24497 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24498
24499 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/package_symbol_loader.hpp"
24500 //package_symbol_loader.hpp
24501 /*
24502 未完成的elc解释器template文件
24503 由steve02081504与Alex0125设计、编写
24504 转载时请在不对此文件做任何修改的同时注明出处
24505 项目地址:https://github.com/steve02081504/ELC
24506 */
24507 namespace package_symbol_loader_n{
24510 function_t<ptr(string lib_name, size_t lib_ver, string symbol_name)noexcept> load_interface;
24511 function_t<ptr()noexcept> load_error_interface;
24512
24514 if(package_symbol_loader_handle = load_lib(paths::package_symbol_loader_path)){
24515 load_interface = package_symbol_loader_handle->get_symbol_as_function<ptr(string lib_name,size_t lib_ver,string symbol_name)noexcept>(es"load_interface");
24516 load_error_interface = package_symbol_loader_handle->get_symbol_as_function<ptr()noexcept>(es"load_error_interface");
24517 }
24518 else
24519 die_with(locale::str::package_symbol_loader::load_failed);
24520 if(!load_interface)
24521 die_with(locale::str::package_symbol_loader::load_interface_failed);
24522 }
24523 ~package_symbol_loader_t()noexcept = default;
24524
24525 ptr load_symbol(string lib_name,size_t lib_ver,string symbol_name)noexcept{
24526 return load_interface(lib_name,lib_ver,symbol_name);
24527 }
24528 ptr get_load_error()noexcept{
24529 return load_error_interface();
24530 }
24531 };
24532 }
24533
24534 //file_end
24535 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24536 #if defined(ELC_TEST_ON)
24537 namespace package_symbol_loader_part_test{
24538 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_test.hpp"
24539 //_test.hpp
24540 /*
24541 未完成的elc解释器template文件
24542 由steve02081504与Alex0125设计、编写
24543 转载时请在不对此文件做任何修改的同时注明出处
24544 项目地址:https://github.com/steve02081504/ELC
24545 */
24546 inline void test(){
24547 ELC_TEST_EVENTNAME("package_symbol_loader部分测试");
24548 }
24549 inline void test_log_out(){}
24550 inline void test_end{}
24551
24552 //file_end
24553
24554 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24555 }
24556 #endif
24557
24558 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
24559 //_undefs.hpp
24560 /*
24561 未完成的elc解释器basic文件
24562 由steve02081504与Alex0125设计、编写
24563 转载时请在不对此文件做任何修改的同时注明出处
24564 项目地址:https://github.com/steve02081504/ELC
24565 */
24566 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
24567 //_undefs.hpp
24568 /*
24569 未完成的elc解释器_share文件
24570 由steve02081504与Alex0125设计、编写
24571 转载时请在不对此文件做任何修改的同时注明出处
24572 项目地址:https://github.com/steve02081504/ELC
24573 */
24574
24575 //defs at "_defs.hpp"
24576
24577 #if defined(_MSC_VER)
24578 #pragma warning(pop)
24579 #endif
24580 #undef suppress_msvc_warning
24581 #undef disable_msvc_warning
24582 #undef push_msvc_warning
24583 #undef pop_msvc_warning
24584 #undef push_and_disable_msvc_warning
24585
24586 //for basic_environment.hpp
24587 #undef BIT_POSSIBILITY
24588 //
24589 #if defined(ELC_VOID_NAME)
24590 #define void the_void
24591 #endif
24592
24593 // #undef often_noexcept
24594 #undef noexcept_as
24595 #undef noexcept_as_auto
24596 #undef constexpr_as
24597 #undef constexpr_as_auto
24598
24599 #undef using_method_from_base_t
24600 #undef using_method_from_value
24601
24602 #undef floop
24603 #undef enable_adl
24604
24605 #undef re_declvalue
24606 #undef re_decltype
24607
24608 #undef declvalue
24609
24610 #undef template_error
24611 #undef template_warning
24612
24613 #undef type_info_of
24614 #undef type_name_of
24615
24616 #undef is_common_attribute
24617 #undef is_special_attribute
24618
24619 #undef has_attribute
24620 #undef not_has_attribute
24621
24622 #undef float_size_of
24623 #undef bitnum_of
24624
24625 #undef def_common_attribute_with_nothing
24626 #undef def_special_attribute_with_nothing
24627
24628 #undef common_attribute_t
24629 #undef special_attribute_t
24630
24631 #undef enable_if
24632 #undef enabled_by_default
24633 #undef disabled_by_default
24634 #undef enable_if_not_ill_form
24635 #undef enable_flag
24636
24637 #undef was_an_ill_form
24638 #undef was_an_ill_form_with_parameter
24639 #undef was_not_an_ill_form
24640 #undef was_not_an_ill_form_and_noexcept
24641 #undef was_not_an_ill_form_with_parameter
24642
24643 #undef recursive_lambda
24644 #undef get_recursive_lambda_caller
24645 #undef lambda
24646 #undef lambda_with_catch
24647 #undef self_recursion
24648 #undef lambda_RLSRRS
24649
24650 #undef MAGIC
24651
24652 #undef nothing
24653
24654 #undef elseif
24655 #undef _big_than_
24656 #undef _small_than_
24657
24658 #if defined(_MSC_VER)
24659 #undef not
24660 #undef and
24661 #undef or
24662 #endif
24663
24664 #undef INTER_NAMESPACE
24665 #undef BREAK_NAMESPACE
24666
24667 #undef szie
24668 #undef form
24669
24670 #undef template_name
24671 #undef type_name
24672
24673 #undef not_in_debug
24674
24675 #undef es
24676 #undef ec
24677
24678 #undef ELC_TEST_EVENTNAME
24679
24680 #undef override_instance_struct
24681
24682 #undef distinctive
24683
24684 #undef force_inline
24685
24686 #undef with_no_vtable
24687
24688 #undef in_consteval
24689
24690 #undef no_vtable_struct
24691 #undef no_vtable_class
24692
24693 //file_end
24694
24695 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
24696
24697 //file_end
24698
24699 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24700 }
24701 namespace elc{
24702 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_export.hpp"
24703 //_export.hpp
24704 //at namespace elc
24705 /*
24706 未完成的elc解释器template文件
24707 由steve02081504与Alex0125设计、编写
24708 转载时请在不对此文件做任何修改的同时注明出处
24709 项目地址:https://github.com/steve02081504/ELC
24710 */
24711 #define export using defs::package_symbol_loader_n::
24712
24713 #undef export
24714
24715 //file_end
24716
24717 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24718 }
24719
24720 //file_end
24721
24722 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
24723 #endif
24724
24725 //file_end
24726
24727 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
24728 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/stream"
24729 //stream
24730 //at namespace ::
24731 /*
24732 未完成的elc解释器include文件
24733 由steve02081504与Alex0125设计、编写
24734 转载时请在不对此文件做任何修改的同时注明出处
24735 项目地址:https://github.com/steve02081504/ELC
24736 */
24737 #if !defined(ELC_STREAM)
24738 #define ELC_STREAM
24739 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
24740 //base
24741 //at namespace ::
24742 /*
24743 未完成的elc解释器include文件
24744 由steve02081504与Alex0125设计、编写
24745 转载时请在不对此文件做任何修改的同时注明出处
24746 项目地址:https://github.com/steve02081504/ELC
24747 */
24748 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
24749
24750 //file_end
24751
24752 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/stream"
24753 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
24754 //_body.hpp
24755 //at namespace ::
24756 /*
24757 未完成的elc解释器stream文件
24758 由steve02081504与Alex0125设计、编写
24759 转载时请在不对此文件做任何修改的同时注明出处
24760 项目地址:https://github.com/steve02081504/ELC
24761 */
24762 #if defined(ELC_TEST)
24763 #error "this part cannot be tested."
24764 #endif
24765 namespace elc::defs{
24766 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
24767 //_defs.hpp
24768 /*
24769 未完成的elc解释器basic文件
24770 由steve02081504与Alex0125设计、编写
24771 转载时请在不对此文件做任何修改的同时注明出处
24772 项目地址:https://github.com/steve02081504/ELC
24773 */
24774 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24775 //_defs.hpp
24776 /*
24777 未完成的elc解释器_share文件
24778 由steve02081504与Alex0125设计、编写
24779 转载时请在不对此文件做任何修改的同时注明出处
24780 项目地址:https://github.com/steve02081504/ELC
24781 */
24782
24783 //undefs at "_undefs.hpp"
24784
24785 //set ELC_WARNING_LEVEL default to 4(max)
24786 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24787
24788 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
24789 //basic_environment.hpp
24790 /*
24791 未完成的elc解释器_share文件
24792 由steve02081504与Alex0125设计、编写
24793 转载时请在不对此文件做任何修改的同时注明出处
24794 项目地址:https://github.com/steve02081504/ELC
24795 */
24796
24797 //每个bit(不是字节)的可能性
24798 //为什么c艹委员会不定义这个?
24799 #define BIT_POSSIBILITY 2
24800
24801 //file_end
24802
24803 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24804
24805 #if defined(_MSC_VER)
24806 #pragma warning(push,ELC_WARNING_LEVEL)
24807 #pragma warning(disable:4099)//class与struct混用警告diss
24808 #pragma warning(disable:26812)//enum class安利diss.
24809 #pragma warning(disable:4584)//重复子类警告diss
24810 #pragma warning(disable:4250)//域控制继承警告diss
24811 #pragma warning(disable:26432)//不完全默认方法警告diss
24812 #pragma warning(disable:26435)//virtual override方法警告diss
24813 #pragma warning(disable:26481)//容器安利diss
24814 #pragma warning(disable:26446)//gsl::at安利diss
24815 #pragma warning(disable:26434)//方法覆盖警告diss
24816 #pragma warning(disable:26429)//gsl::not_null安利diss
24817 #pragma warning(disable:26471)//对void*进行static_cast安利diss
24818 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
24819 #pragma warning(disable:26473)//相同指针显式cast警告diss
24820 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
24821 #pragma warning(disable:26485)//数组作指针警告diss
24822 #pragma warning(disable:26490)//reinterpret_cast警告diss
24823 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
24824 #pragma warning(disable:26482)//非常数数组索引警告diss
24825 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
24826 #endif
24827 #if defined(_MSC_VER)
24828 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
24829 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
24830 #define push_msvc_warning() __pragma(warning(push))
24831 #define pop_msvc_warning() __pragma(warning(pop))
24832 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
24833 #else
24834 #define suppress_msvc_warning(...)
24835 #define disable_msvc_warning(...)
24836 #define push_msvc_warning()
24837 #define pop_msvc_warning()
24838 #define push_and_disable_msvc_warning(...)
24839 #endif
24840 //
24841 #if defined(ELC_VOID_NAME)
24842 #undef void
24843 #endif
24844
24845 // #define often_noexcept
24846 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
24847 #define noexcept_as_auto MAGIC//哦现在有了
24848 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
24849 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
24850
24851 #define using_method_from_base_t(name,...) \
24852 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
24853 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
24854 {\
24855 return base_t::name(forward<Args>(rest)...);\
24856 }\
24857
24858 #define using_method_from_value(name,value_name,...) \
24859 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
24860 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
24861 {\
24862 return value_name.name(forward<Args>(rest)...);\
24863 }\
24864
24865 #define floop while(__builtin_is_my_dick_still_there())
24866 #define enable_adl(name) void name()noexcept=delete
24867
24868 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
24869 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
24870
24871 #define declvalue(...) (::std::declval<__VA_ARGS__>())
24872
24873 /*实例化到此将引发错误*/
24874 #define template_error(reason) static_assert(template_error_helper<T>,reason)
24875 /*实例化到此将引发警告*/
24876 #define template_warning(reason) template_warning_helper<T>(reason)
24877
24878 //for type_info
24879 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
24880 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
24881
24882 #define is_common_attribute(name) public attribute<T,name<T>>
24883 #define is_special_attribute(name) public attribute<T,name>
24884
24885 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
24886 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
24887
24888 //for float_size_t
24889 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
24890 //bitnum_of
24891 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
24892
24893 //for attribute
24894 #define def_common_attribute_with_nothing(name) \
24895 template<typename T>\
24896 class name{}\
24897
24898 #define def_special_attribute_with_nothing(name) \
24899 class name{}\
24900
24901 #define common_attribute_t template<class>class
24902 #define special_attribute_t class
24903
24904 /*
24905 若参数的布尔值为零,那么此模板不会实例化
24906
24907 为什么不用cpp20的constraints?
24908 1.不能类内定义
24909 2.不能作为模板参数
24910 一句话总结:c艹标准会sb
24911 */
24912 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
24913 /*默认参与模板候选*/
24914 #define enabled_by_default class enable_state=void
24915 /*默认不参与模板候选*/
24916 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
24917 /*若参数为病式,那么此模板不会实例化*/
24918 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
24919 /*用于模板声明*/
24920 #define enable_flag class enable_state
24921
24922 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
24923 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
24924 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
24925 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
24926 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
24927
24928 /*让lambda递归更加美观*/
24929 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
24930 /*让lambda递归更加美观*/
24931 #define get_recursive_lambda_caller(name) \
24932 lambda_with_catch(&)(auto&&...Args){\
24933 return name(name,Args...);\
24934 }
24935 /*让lambda定义更加美观*/
24936 #define lambda []
24937 /*让lambda定义更加美观*/
24938 #define lambda_with_catch(...) [__VA_ARGS__]
24939 /*让lambda递归更加美观*/
24940 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
24941 //recursive_lambda_self_referential_reserved_symbolname
24942 #define lambda_RLSRRS _my_jb_super_sb_name_
24943
24944 #define MAGIC//ahh,ko no tenno da!
24945
24946 /*装饰性语法糖*/
24947 #define nothing
24948
24949 /*aya风格语法糖*/
24950 #define elseif else if
24951 /*aya风格语法糖*/
24952 #define _big_than_ >
24953 /*aya风格语法糖*/
24954 #define _small_than_ <
24955
24956 #if defined(_MSC_VER)
24957 #define not !
24958 #define and &&
24959 #define or ||
24960 #endif
24961
24962 /*进入名称空间,并不是很美观*/
24963 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
24964 /*退出名称空间,并不是很美观*/
24965 #define BREAK_NAMESPACE }
24966
24967 /*template说明符*/
24968 #define template_name template
24969 /*template说明符*/
24970 #define type_name class
24971
24972 #if defined(DEBUG) || defined(_DEBUG)
24973 #define not_in_debug 0
24974 #else
24975 #define not_in_debug 1
24976 #endif
24977
24978 #define es U""
24979 #define ec(ch) U ## ch
24980
24981 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
24982 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
24983 #else
24984 #define ELC_TEST_EVENTNAME(name)
24985 #endif
24986
24987 #define override_instance_struct \
24988 protected:\
24989 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
24990 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
24991 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
24992 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
24993 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
24994
24995 #if defined(_WIN32)
24996 #define distinctive __declspec(dllexport)
24997 #else
24998 #define distinctive
24999 #endif
25000
25001 #if defined(_WIN32)
25002 #define force_inline __forceinline
25003 #elif defined(__GNUC__)
25004 #define force_inline __attribute__((always_inline)) inline
25005 #else
25006 #define force_inline inline
25007 #endif
25008
25009 #if defined(_WIN32)
25010 #define with_no_vtable __declspec(novtable)
25011 #else
25012 #define with_no_vtable
25013 #endif
25014
25015 #define in_consteval (::std::is_constant_evaluated())
25016
25017 #define no_vtable_struct struct with_no_vtable
25018 #define no_vtable_class class with_no_vtable
25019
25020 //file_end
25021
25022 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
25023
25024 //file_end
25025
25026 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25027
25028 #if defined(ELC_TEST_ON)
25029 namespace stream_part_test{
25030 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_test.hpp"
25031 //_test.hpp
25032 /*
25033 未完成的elc解释器stream文件
25034 由steve02081504与Alex0125设计、编写
25035 转载时请在不对此文件做任何修改的同时注明出处
25036 项目地址:https://github.com/steve02081504/ELC
25037 */
25038 inline void test(){
25039 ELC_TEST_EVENTNAME("stream部分测试");
25040 }
25041 inline void test_log_out(){
25042 }
25043 inline void test_end{
25044 }
25045
25046 //file_end
25047
25048 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25049 }
25050 #endif
25051
25052 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
25053 //_undefs.hpp
25054 /*
25055 未完成的elc解释器basic文件
25056 由steve02081504与Alex0125设计、编写
25057 转载时请在不对此文件做任何修改的同时注明出处
25058 项目地址:https://github.com/steve02081504/ELC
25059 */
25060 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
25061 //_undefs.hpp
25062 /*
25063 未完成的elc解释器_share文件
25064 由steve02081504与Alex0125设计、编写
25065 转载时请在不对此文件做任何修改的同时注明出处
25066 项目地址:https://github.com/steve02081504/ELC
25067 */
25068
25069 //defs at "_defs.hpp"
25070
25071 #if defined(_MSC_VER)
25072 #pragma warning(pop)
25073 #endif
25074 #undef suppress_msvc_warning
25075 #undef disable_msvc_warning
25076 #undef push_msvc_warning
25077 #undef pop_msvc_warning
25078 #undef push_and_disable_msvc_warning
25079
25080 //for basic_environment.hpp
25081 #undef BIT_POSSIBILITY
25082 //
25083 #if defined(ELC_VOID_NAME)
25084 #define void the_void
25085 #endif
25086
25087 // #undef often_noexcept
25088 #undef noexcept_as
25089 #undef noexcept_as_auto
25090 #undef constexpr_as
25091 #undef constexpr_as_auto
25092
25093 #undef using_method_from_base_t
25094 #undef using_method_from_value
25095
25096 #undef floop
25097 #undef enable_adl
25098
25099 #undef re_declvalue
25100 #undef re_decltype
25101
25102 #undef declvalue
25103
25104 #undef template_error
25105 #undef template_warning
25106
25107 #undef type_info_of
25108 #undef type_name_of
25109
25110 #undef is_common_attribute
25111 #undef is_special_attribute
25112
25113 #undef has_attribute
25114 #undef not_has_attribute
25115
25116 #undef float_size_of
25117 #undef bitnum_of
25118
25119 #undef def_common_attribute_with_nothing
25120 #undef def_special_attribute_with_nothing
25121
25122 #undef common_attribute_t
25123 #undef special_attribute_t
25124
25125 #undef enable_if
25126 #undef enabled_by_default
25127 #undef disabled_by_default
25128 #undef enable_if_not_ill_form
25129 #undef enable_flag
25130
25131 #undef was_an_ill_form
25132 #undef was_an_ill_form_with_parameter
25133 #undef was_not_an_ill_form
25134 #undef was_not_an_ill_form_and_noexcept
25135 #undef was_not_an_ill_form_with_parameter
25136
25137 #undef recursive_lambda
25138 #undef get_recursive_lambda_caller
25139 #undef lambda
25140 #undef lambda_with_catch
25141 #undef self_recursion
25142 #undef lambda_RLSRRS
25143
25144 #undef MAGIC
25145
25146 #undef nothing
25147
25148 #undef elseif
25149 #undef _big_than_
25150 #undef _small_than_
25151
25152 #if defined(_MSC_VER)
25153 #undef not
25154 #undef and
25155 #undef or
25156 #endif
25157
25158 #undef INTER_NAMESPACE
25159 #undef BREAK_NAMESPACE
25160
25161 #undef szie
25162 #undef form
25163
25164 #undef template_name
25165 #undef type_name
25166
25167 #undef not_in_debug
25168
25169 #undef es
25170 #undef ec
25171
25172 #undef ELC_TEST_EVENTNAME
25173
25174 #undef override_instance_struct
25175
25176 #undef distinctive
25177
25178 #undef force_inline
25179
25180 #undef with_no_vtable
25181
25182 #undef in_consteval
25183
25184 #undef no_vtable_struct
25185 #undef no_vtable_class
25186
25187 //file_end
25188
25189 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
25190
25191 //file_end
25192
25193 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25194 }
25195 namespace elc{
25196 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_export.hpp"
25197 //_export.hpp
25198 //at namespace elc
25199 /*
25200 未完成的elc解释器stream文件
25201 由steve02081504与Alex0125设计、编写
25202 转载时请在不对此文件做任何修改的同时注明出处
25203 项目地址:https://github.com/steve02081504/ELC
25204 */
25205 #define export using defs::
25206 #undef export
25207
25208 //file_end
25209
25210 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25211 }
25212
25213 //file_end
25214
25215 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/stream"
25216 #endif
25217
25218 //file_end
25219
25220 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
25221 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
25222 //string
25223 //at namespace ::
25224 /*
25225 未完成的elc解释器include文件
25226 由steve02081504与Alex0125设计、编写
25227 转载时请在不对此文件做任何修改的同时注明出处
25228 项目地址:https://github.com/steve02081504/ELC
25229 */
25230 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
25231
25232 //file_end
25233
25234 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
25235 //#include "test"
25236 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/void_name"
25237 //void_name
25238 //at namespace ::
25239 /*
25240 未完成的elc解释器include文件
25241 由steve02081504与Alex0125设计、编写
25242 转载时请在不对此文件做任何修改的同时注明出处
25243 项目地址:https://github.com/steve02081504/ELC
25244 */
25245 #if !defined(ELC_VOID_NAME)
25246 #define ELC_VOID_NAME
25247 typedef void the_void;
25248 #define void the_void
25249 #endif
25250
25251 //file_end
25252
25253 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
25254#endif
25255
25256//file_end
25257
#define get_recursive_lambda_caller(name)
Definition: all_defs.cpp:24931
#define void
Definition: all_defs.cpp:25248
#define _small_than_
Definition: all_defs.cpp:24954
#define in_consteval
Definition: all_defs.cpp:25015
#define was_not_an_ill_form(...)
Definition: all_defs.cpp:24924
#define export
Definition: all_defs.cpp:25205
#define special_attribute_t
Definition: all_defs.cpp:24902
#define float_size_of(...)
Definition: all_defs.cpp:24889
#define other
Definition: all_defs.cpp:23728
#define was_not_an_ill_form_and_noexcept(...)
Definition: all_defs.cpp:24925
#define DYNAMIC_LIBRARY_SUFFIX
Definition: all_defs.cpp:24006
#define template_name
Definition: all_defs.cpp:24968
#define INTER_NAMESPACE(NAMESPACENAME)
Definition: all_defs.cpp:24963
#define was_not_an_ill_form_with_parameter(...)
Definition: all_defs.cpp:24926
#define hash
Definition: all_defs.cpp:2133
#define defspecflag(name)
Definition: all_defs.cpp:993
#define bitnum_of(...)
Definition: all_defs.cpp:24891
#define using_method_from_value(name, value_name,...)
Definition: all_defs.cpp:24858
#define ec(ch)
Definition: all_defs.cpp:24979
#define was_an_ill_form(...)
Definition: all_defs.cpp:24922
#define elseif
Definition: all_defs.cpp:24950
#define enable_flag
Definition: all_defs.cpp:24920
#define template_error(reason)
Definition: all_defs.cpp:24874
#define lambda_with_catch(...)
Definition: all_defs.cpp:24938
#define expr
Definition: all_defs.cpp:10348
#define pop_msvc_warning()
Definition: all_defs.cpp:24837
#define es
Definition: all_defs.cpp:24978
#define suppress_msvc_warning(...)
Definition: all_defs.cpp:24834
#define declvalue(...)
Definition: all_defs.cpp:24871
#define push_and_disable_msvc_warning(...)
Definition: all_defs.cpp:24838
#define def_note(name)
Definition: all_defs.cpp:1767
#define ELC_TEST_EVENTNAME(name)
Definition: all_defs.cpp:24984
#define has_attribute(...)
Definition: all_defs.cpp:24885
#define _m
Definition: all_defs.cpp:17231
#define type_name
Definition: all_defs.cpp:24970
#define floop
Definition: all_defs.cpp:24865
#define is_common_attribute(name)
Definition: all_defs.cpp:24882
#define nothing
Definition: all_defs.cpp:24947
#define constexpr_as(...)
Definition: all_defs.cpp:24848
#define template_warning(reason)
Definition: all_defs.cpp:24876
#define recursive_lambda(...)
Definition: all_defs.cpp:24929
#define constexpr_as_auto
Definition: all_defs.cpp:24849
void the_void
Definition: all_defs.cpp:25247
#define BREAK_NAMESPACE
Definition: all_defs.cpp:24965
#define noexcept_as(...)
Definition: all_defs.cpp:24846
#define no_vtable_class
Definition: all_defs.cpp:25018
#define override_instance_struct
Definition: all_defs.cpp:24987
#define lambda
Definition: all_defs.cpp:24936
#define def_special_attribute_with_nothing(name)
Definition: all_defs.cpp:24898
#define force_inline
Definition: all_defs.cpp:25006
#define self_recursion(...)
Definition: all_defs.cpp:24940
#define _big_than_
Definition: all_defs.cpp:24952
#define no_vtable_struct
Definition: all_defs.cpp:25017
#define enable_if(...)
Definition: all_defs.cpp:24912
#define distinctive
Definition: all_defs.cpp:24998
#define common_attribute_t
Definition: all_defs.cpp:24901
#define BIT_POSSIBILITY
Definition: all_defs.cpp:24799
#define enable_adl(name)
Definition: all_defs.cpp:24866
#define def_common_attribute_with_nothing(name)
Definition: all_defs.cpp:24894
constexpr flag(flag_set_type a=not_set) noexcept
Definition: all_defs.cpp:6310
flag(flag &&a) noexcept
Definition: all_defs.cpp:6313
void set() noexcept
Definition: all_defs.cpp:6316
void operator=(flag &) &noexcept=delete
void unset() noexcept
Definition: all_defs.cpp:6317
void operator=(flag &&) &noexcept=delete
flag(flag &a) noexcept
Definition: all_defs.cpp:6312
constexpr same_base_t(const same_base_t< other_T, other_base_t > &a) noexcept(construct< base_t_rw >.nothrow< other_base_t >)
Definition: all_defs.cpp:6497
constexpr value_type operator*() noexcept(noexcept((is_value_getter_noexcept())))
Definition: all_defs.cpp:6501
base_t_w next_getter() const noexcept(is_next_getter_noexcept())
Definition: all_defs.cpp:6463
static constexpr bool is_handle_getter_noexcept() noexcept
Definition: all_defs.cpp:6406
constexpr same_base_t(const this_t &a) noexcept(construct< base_t_rw >.nothrow< const base_t_rw >)
Definition: all_defs.cpp:6494
~same_base_t() noexcept(destruct.nothrow< base_t_rw >)=default
value_t * handle_getter() const noexcept(is_handle_getter_noexcept())
Definition: all_defs.cpp:6414
constexpr void swap_with(this_t &a) noexcept(noexcept((swap((::std::declval< base_t_rw & >()),(::std::declval< base_t_rw & >())))))
Definition: all_defs.cpp:6489
decltype(value_type_getter()) ::template type value_type
Definition: all_defs.cpp:6442
constexpr auto operator<=>(const same_base_t< other_value_t, other_base_t_w > &a) const noexcept(compare.nothrow< base_t_rw, other_base_t_w >)
Definition: all_defs.cpp:6509
constexpr same_base_t() noexcept=default
static constexpr bool is_value_getter_noexcept() noexcept
Definition: all_defs.cpp:6423
constexpr same_base_t(this_t &&a) noexcept(noexcept(((::std::declval< this_t >()).swap_with(a))))
Definition: all_defs.cpp:6495
base_t_w before_getter() const noexcept(is_before_getter_noexcept())
Definition: all_defs.cpp:6480
static constexpr bool is_before_getter_noexcept() noexcept
Definition: all_defs.cpp:6472
constexpr value_t * operator->() noexcept(is_handle_getter_noexcept())
Definition: all_defs.cpp:6500
static constexpr auto value_type_getter()
Definition: all_defs.cpp:6432
same_base_t< value_t, base_t_w > this_t
Definition: all_defs.cpp:6401
static constexpr bool is_next_getter_noexcept() noexcept
Definition: all_defs.cpp:6455
value_type value_getter() const noexcept(is_handle_getter_noexcept())
Definition: all_defs.cpp:6444
constexpr bool operator==(value_t *a) const noexcept(is_handle_getter_noexcept()&&noexcept(pointer_equal((::std::declval< value_t * >()),(::std::declval< value_t * >()))))
Definition: all_defs.cpp:6503
constexpr void add(cons *a) noexcept
Definition: all_defs.cpp:6652
iterator_t< T, cons * > iterator
Definition: all_defs.cpp:6647
constexpr list_t() noexcept
Definition: all_defs.cpp:6651
constexpr iterator begin() noexcept
Definition: all_defs.cpp:6655
constexpr iterator head() noexcept
Definition: all_defs.cpp:6657
constexpr bool empty() const noexcept
Definition: all_defs.cpp:6658
constexpr iterator end() noexcept
Definition: all_defs.cpp:6656
constexpr rot_iterator operator--(int) noexcept
Definition: all_defs.cpp:645
constexpr rot_iterator & operator--() noexcept
Definition: all_defs.cpp:634
constexpr rot_iterator(size_t offset) noexcept
Definition: all_defs.cpp:627
constexpr size_t value() const noexcept
Definition: all_defs.cpp:650
constexpr rot_iterator operator++(int) noexcept
Definition: all_defs.cpp:640
constexpr rot_iterator & operator++() noexcept
Definition: all_defs.cpp:628
constexpr mark_able(mark_type a=not_mark) noexcept
Definition: all_defs.cpp:6343
void mark() const noexcept
Definition: all_defs.cpp:6344
bool was_marked() const noexcept
Definition: all_defs.cpp:6346
void unmark() const noexcept
Definition: all_defs.cpp:6345
constexpr maybe_fail_reference(note::fail_t)
Definition: all_defs.cpp:3305
constexpr maybe_fail_reference(const maybe_fail_reference &)=default
friend this_t operator+(const this_t &a, U &&b) noexcept(noexcept((a.copy()+=b)))
Definition: all_defs.cpp:9002
constexpr auto operator==(array_like_view_t< const T > a) const noexcept(equal.nothrow< array_like_view_t< T > >)
Definition: all_defs.cpp:8946
array_t(const this_t &a) noexcept(noexcept(((::std::declval< this_t >()).copy())))
Definition: all_defs.cpp:8844
friend this_t operator+(U &&a, const this_t &b) noexcept(noexcept((this_t(a)+=b)))
Definition: all_defs.cpp:9006
constexpr iterator get_iterator_at(size_t a) noexcept
Definition: all_defs.cpp:8918
const_iterator_t< T > const_iterator
Definition: all_defs.cpp:8916
this_t && operator+(U &&b) &&noexcept(noexcept((*this+=b)))
Definition: all_defs.cpp:9011
friend this_t & operator+=(this_t &a, zero_t b) noexcept(get< T >.apply_end.nothrow< T >)
Definition: all_defs.cpp:8998
void insert(size_t index, size_t count, const T *data) noexcept(insert_nothrow)
Definition: all_defs.cpp:8884
void insert_with_forward_resize(size_t index, size_t count, const T *data, size_t new_size) noexcept(insert_with_forward_resize_nothrow)
Definition: all_defs.cpp:8897
array_t(U &&a) noexcept(get< T >.as_array.nothrow< U >)
Definition: all_defs.cpp:8836
friend this_t & operator+=(this_t &a, U &&b) noexcept(get< T >.apply_end.nothrow< U >)
Definition: all_defs.cpp:8994
void forward_resize(size_t size) noexcept(forward_resize_nothrow)
Definition: all_defs.cpp:8871
constexpr auto operator==(const this_t &a) const noexcept(equal.nothrow< array_like_view_t< T > >)
Definition: all_defs.cpp:8952
void resize(size_t size) noexcept(resize_nothrow)
Definition: all_defs.cpp:8864
this_t & operator=(const this_t &a) &noexcept(noexcept(((::std::declval< this_t >()).copy())))
Definition: all_defs.cpp:8845
const_iterator end() const noexcept
Definition: all_defs.cpp:8933
iterator find(U &&a) noexcept
Definition: all_defs.cpp:9017
const T & operator[](size_t pos) const noexcept
Definition: all_defs.cpp:8910
~array_t() noexcept(unget.nothrow< T >)
Definition: all_defs.cpp:8854
void swap_with(this_t &a) noexcept
Definition: all_defs.cpp:8807
constexpr auto operator<=>(const this_t &a) const noexcept(compare.nothrow< array_like_view_t< T > >)
Definition: all_defs.cpp:8949
const_iterator cbegin() const noexcept
Definition: all_defs.cpp:8936
size_t size_in_byte() const noexcept
Definition: all_defs.cpp:8860
constexpr auto operator<=>(array_like_view_t< const T > a) const noexcept(compare.nothrow< array_like_view_t< T > >)
Definition: all_defs.cpp:8943
T & operator[](size_t pos) noexcept
Definition: all_defs.cpp:8909
this_t & operator=(this_t &&a) &noexcept
Definition: all_defs.cpp:8849
const_iterator find(U &&a) const noexcept
Definition: all_defs.cpp:9021
void clear() noexcept(re_construct.nothrow< this_t >)
Definition: all_defs.cpp:8906
array_t(note::size_t< size_t >size) noexcept(get< T >.nothrow<>)
Definition: all_defs.cpp:8819
const_iterator cend() const noexcept
Definition: all_defs.cpp:8939
array_t(note::size_t< size_t >size, const T &elem) noexcept(get< T >.nothrow<>)
Definition: all_defs.cpp:8825
constexpr iterator begin() noexcept
Definition: all_defs.cpp:8924
void insert(size_t index, size_t count) noexcept(insert_nothrow)
Definition: all_defs.cpp:8878
constexpr const_iterator begin() const noexcept
Definition: all_defs.cpp:8930
void insert_with_resize(size_t index, size_t count, const T *data, size_t new_size) noexcept(insert_nothrow)
Definition: all_defs.cpp:8890
constexpr const_iterator get_iterator_at(size_t a) const noexcept
Definition: all_defs.cpp:8921
~hash_table_t() noexcept(destruct.nothrow< base_t_w >)=default
void add(const T &a) noexcept(hash_nothrow< const T & > &&bucket_t::add_nothrow)
Definition: all_defs.cpp:10096
bool remove(const T &a) noexcept(bucket_t::remove_nothrow)
Definition: all_defs.cpp:10102
hash_table_t(special_init_t, size_t bucket_size) noexcept
Definition: all_defs.cpp:10073
this_t & operator=(base_t_w &&a) &noexcept
Definition: all_defs.cpp:10082
maybe_fail_reference< T > find(U &&a) noexcept(find_nothrow< U >)
Definition: all_defs.cpp:10118
this_t & operator=(const base_t_w &a) &noexcept
Definition: all_defs.cpp:10086
bool in_table(const T &a) noexcept(noexcept(((::std::declval< this_t >()).find(a).not_fail())))
Definition: all_defs.cpp:10134
bool not_in_table(const T &a) noexcept(noexcept(((::std::declval< this_t >()).in_table(a))))
Definition: all_defs.cpp:10137
void clear() noexcept(re_construct.nothrow< this_t >)
Definition: all_defs.cpp:10149
void clear() noexcept(re_construct.nothrow< this_t >)
Definition: all_defs.cpp:10335
this_t & operator=(const this_t &a) noexcept
Definition: all_defs.cpp:10316
const T & operator[](const key_t &a) const noexcept
Definition: all_defs.cpp:10331
T & operator[](const key_t &a) noexcept(noexcept((_m.add({a, T()}))))
Definition: all_defs.cpp:10323
bool operator==(const this_t &a) const noexcept(shrink_nothow &&equal.nothrow< T >)
Definition: all_defs.cpp:10366
void shrink() const noexcept(shrink_nothow)
Definition: all_defs.cpp:10358
void swap(map_t< T, key_t, stack_t, _ > &a) noexcept
Definition: all_defs.cpp:10321
this_t & operator=(const this_t &a) &noexcept(noexcept(((::std::declval< this_t >()).copy())))
Definition: all_defs.cpp:9804
base_stack_t(const this_t &a) noexcept(noexcept(((::std::declval< this_t >()).copy())))
Definition: all_defs.cpp:9807
hash_t get_top_hash() noexcept(noexcept((hash((::std::declval< T & >())))))
Definition: all_defs.cpp:9893
void clear() noexcept(re_construct.nothrow< this_t >)
Definition: all_defs.cpp:9817
bool remove(const T_ &a) noexcept(remove_nothrow &&equal.nothrow< T_, T >)
Definition: all_defs.cpp:9851
bool not_in_stack(const T &a) const noexcept(noexcept(((::std::declval< this_t >()).in_stack(a))))
Definition: all_defs.cpp:9836
bool in_stack(const T &a) const noexcept(noexcept(((::std::declval< this_t >()).find(a).not_fail())))
Definition: all_defs.cpp:9833
~base_stack_t() noexcept(unget.nothrow< data_t >)
Definition: all_defs.cpp:9808
void add(const T &a) noexcept(add_nothrow)
Definition: all_defs.cpp:9844
struct elc::defs::container::stack_n::base_stack_t::data_t * _m
maybe_fail_reference< T > find(U &&a) noexcept(noexcept(((::std::declval< T & >())==a)))
Definition: all_defs.cpp:9824
this_t & operator=(this_t &&a) &noexcept
Definition: all_defs.cpp:9797
constexpr exception() noexcept=default
virtual void * _abstract_method_get_forward_resize_this(size_t size)=0
virtual size_t abstract_method_get_size_of_get_for_this() noexcept=0
virtual void * _abstract_method_get_resize_this(size_t size)=0
virtual size_t abstract_method_get_size_of_get_for_this() noexcept override
Definition: all_defs.cpp:8052
virtual void * _abstract_method_get_forward_resize_this(size_t size) noexcept(get_forward_resize.able< T >?get_forward_resize.nothrow< T >:1) override
Definition: all_defs.cpp:8043
virtual void abstract_method_unget_this() noexcept(noexcept((unget(get_handle(this))))) override
Definition: all_defs.cpp:8024
virtual void * _abstract_method_get_resize_this(size_t size) noexcept(get_resize.able< T >?get_resize.nothrow< T >:1) override
Definition: all_defs.cpp:8034
virtual void * _abstract_method_copy_get_this() noexcept(copy_get.able< T >?copy_get.nothrow< T >:1) override
Definition: all_defs.cpp:8025
void add_gc_method(type_info_t< T >) noexcept
Definition: all_defs.cpp:10677
void remove_gc_success_identifier(success_identifier_t a)
Definition: all_defs.cpp:10672
void operator()() const noexcept
Definition: all_defs.cpp:10642
void add_gc_method(gc_method_t a) noexcept
Definition: all_defs.cpp:10662
void remove_gc_method(type_info_t< T >) noexcept
Definition: all_defs.cpp:10682
void add_gc_success_identifier(success_identifier_t a) noexcept
Definition: all_defs.cpp:10669
bool success() const noexcept
Definition: all_defs.cpp:10651
void remove_gc_method(gc_method_t a)
Definition: all_defs.cpp:10665
root_of() noexcept(noexcept((roots_of< T >.add((::std::declval< this_t * >())))))
Definition: all_defs.cpp:10545
virtual void map_and_mark() noexcept=0
Definition: all_defs.cpp:10554
constexpr roots_t() noexcept=default
constexpr placement_construct_t operator[](T *p) const noexcept
Definition: all_defs.cpp:5710
T operator()(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:5645
void cut_ref() const noexcept
Definition: all_defs.cpp:8207
constexpr ref_t() noexcept=default
constexpr void add_ref() const noexcept
Definition: all_defs.cpp:8129
constexpr void init_never_ref_num_zero() noexcept
Definition: all_defs.cpp:8133
link_num_t link_num() const noexcept
Definition: all_defs.cpp:8134
bool cut_ref() const noexcept
Definition: all_defs.cpp:8130
arec_t && operator=(const arec_t &&ch) &&noexcept
Definition: all_defs.cpp:17512
arec_t && operator=(char_T a) &&noexcept
Definition: all_defs.cpp:17508
const char_T * operator&() const &&noexcept
Definition: all_defs.cpp:17518
arec_t(string_t *to, size_t index) noexcept
Definition: all_defs.cpp:17505
arec_t(special_init_t, const arec_t &ref) noexcept
Definition: all_defs.cpp:17506
floating_arec_t && operator=(floating_arec_result_type a) &&noexcept
Definition: all_defs.cpp:17588
floating_arec_t(special_init_t, const floating_arec_t &ref) noexcept
Definition: all_defs.cpp:17579
floating_arec_t(string_t *to, float_t index) noexcept
Definition: all_defs.cpp:17575
pointer correct_pointer(pointer a, size_t align)
Definition: all_defs.cpp:3842
constexpr size_t overhead_get_offset_value(size_t align)
Definition: all_defs.cpp:3831
void set_overhead(pointer a, size_t size)
Definition: all_defs.cpp:3851
pointer recorrect_pointer(pointer a, size_t align)
Definition: all_defs.cpp:3845
constexpr size_t correct_size(size_t size, size_t align)
Definition: all_defs.cpp:3836
constexpr size_t overhead_get_align(size_t align)
Definition: all_defs.cpp:3828
constexpr size_t correct_align(size_t align)
Definition: all_defs.cpp:3839
size_t get_overhead(const_pointer a)
Definition: all_defs.cpp:3854
void free(byte *p, size_t align) noexcept
Definition: all_defs.cpp:4057
size_t get_size_of_alloc(const byte *p, size_t align) noexcept
Definition: all_defs.cpp:4080
struct elc::APIs::alloc::source_location_info_t operate_source_location
byte * aligned_alloc(size_t align, size_t size) noexcept
Definition: all_defs.cpp:3984
byte * realloc(byte *ptr, size_t nsize, size_t align) noexcept
Definition: all_defs.cpp:4021
void die_with(const char_t *err_msg) noexcept
Definition: all_defs.cpp:4553
void die() noexcept
Definition: all_defs.cpp:4541
void base_free_library(library_handle handle) noexcept
Definition: all_defs.cpp:21148
void * get_symbol(library_handle handle, string symbol_name) noexcept
Definition: all_defs.cpp:21177
library_handle load_library(string file_name) noexcept
Definition: all_defs.cpp:21167
void * base_get_symbol(library_handle handle, const char *symbol_name) noexcept
Definition: all_defs.cpp:21156
library_handle base_load_library(const char *file_name) noexcept
Definition: all_defs.cpp:21129
string base_get_load_error() noexcept
Definition: all_defs.cpp:21139
void free_library(library_handle handle) noexcept
Definition: all_defs.cpp:21174
string get_load_error() noexcept
Definition: all_defs.cpp:21171
string_t< char_t > to_char_t_str(string_view_t< char > a) noexcept
Definition: all_defs.cpp:18597
string_t< char > to_char_str(string_view_t< char_t > a) noexcept
Definition: all_defs.cpp:18578
constexpr auto begin_of_array_like(T &&a) noexcept
Definition: all_defs.cpp:1810
constexpr size_t size_of_array_like(T &&) noexcept
Definition: all_defs.cpp:1803
constexpr bool is_array_like_for
Definition: all_defs.cpp:1833
constexpr bool is_not_signal_value_for_array_like
Definition: all_defs.cpp:1830
constexpr bool is_signal_value_for_array_like
Definition: all_defs.cpp:1828
auto end_of_array_like(T &&a) noexcept
Definition: all_defs.cpp:1817
constexpr auto empty_constexpr_str_of
Definition: all_defs.cpp:3078
function_type_getter< T >::type get_function_type
Definition: all_defs.cpp:6714
constexpr auto function_type_getter_conditional_helper()
Definition: all_defs.cpp:6696
void the_pointer_hash() noexcept=delete
struct elc::defs::base::hash_n::hash_t hash
constexpr hash_value_t pointer_hash(T *a) noexcept
Definition: all_defs.cpp:2086
constexpr bool is_unstable_hash
Definition: all_defs.cpp:2080
constexpr bool is_fundamental_hash
Definition: all_defs.cpp:2082
void swap(same_base_t< value_t, base_t_w > &a, same_base_t< value_t, base_t_w > &b) noexcept(noexcept((a.swap_with(b))))
Definition: all_defs.cpp:6515
auto operator<=>(const reverse_base_t< base_t > &a, const reverse_base_t< base_t > &b) noexcept(compare.nothrow< base_t >)
Definition: all_defs.cpp:6376
constexpr auto get_result(auto y1, auto k, auto δx) noexcept
Definition: all_defs.cpp:873
constexpr auto get_reverse_result(auto k, auto δx, auto y) noexcept
Definition: all_defs.cpp:877
constexpr auto get_k(auto y1, auto y2, auto δx) noexcept
Definition: all_defs.cpp:865
requires ::std::is_arithmetic_v< T > constexpr T copy_as_negative(auto x, bool negative=1) noexcept
Definition: all_defs.cpp:499
constexpr void set_rounding(int mode)
Definition: all_defs.cpp:538
requires ::std::is_floating_point_v< T > constexpr auto trunc(const T v) noexcept
Definition: all_defs.cpp:761
requires ::std::is_unsigned_v< T > constexpr auto rotr(const T v, const auto R) noexcept
Definition: all_defs.cpp:609
requires ::std::is_arithmetic_v< T > constexpr bool feq(const T a, const T b) noexcept
Definition: all_defs.cpp:688
constexpr size_t get_next_gold_size_to_resize_for_array(size_t size)
Definition: all_defs.cpp:847
constexpr auto pow(const T a, const U b) noexcept
Definition: all_defs.cpp:750
constexpr size_t get_next_gold_size_to_resize_for_hash(size_t size)
Definition: all_defs.cpp:854
requires ::std::is_arithmetic_v< T > constexpr auto abs(const T v) noexcept
Definition: all_defs.cpp:680
constexpr auto sub(const T1 a, const T2 b) noexcept
Definition: all_defs.cpp:693
requires ::std::is_floating_point_v< T > constexpr auto ceil(const T v) noexcept
Definition: all_defs.cpp:772
requires ::std::is_arithmetic_v< T > constexpr auto log(const T a) noexcept
Definition: all_defs.cpp:727
requires ::std::is_arithmetic_v< T1 > and ::std::is_arithmetic_v< T2 > constexpr auto mod(T1 a, T2 b)
Definition: all_defs.cpp:530
requires ::std::is_arithmetic_v< T > constexpr bool is_negative(T x) noexcept
Definition: all_defs.cpp:487
requires ::std::is_unsigned_v< T > constexpr auto rotl_nomod(const T v, const auto R) noexcept
Definition: all_defs.cpp:589
requires ::std::is_unsigned_v< T > constexpr auto rotr_nomod(const T v, const auto r) noexcept
Definition: all_defs.cpp:569
requires ::std::is_arithmetic_v< T > constexpr bool is_prime_num(T a)
Definition: all_defs.cpp:786
requires ::std::is_arithmetic_v< T > constexpr size_t to_size_t(T x) noexcept
Definition: all_defs.cpp:514
requires ::std::is_unsigned_v< T > constexpr auto rotl(const T v, const auto R) noexcept
Definition: all_defs.cpp:617
constexpr int get_rounding()
Definition: all_defs.cpp:544
requires ::std::is_arithmetic_v< T >constexpr ::std::uintmax_t to_uintmax_t(T x) noexcept
Definition: all_defs.cpp:522
constexpr auto gold_of_resize
Definition: all_defs.cpp:475
requires ::std::is_floating_point_v< T > constexpr T exp(const T v) noexcept
Definition: all_defs.cpp:708
requires ::std::is_arithmetic_v< T > constexpr T get_prime_num_big_or_eq_than(T a)
Definition: all_defs.cpp:838
constexpr struct elc::defs::base::note_n::fail_t fail
constexpr size_t< T > size(T v)
Definition: all_defs.cpp:1782
constexpr auto get_null_ptr() noexcept
Definition: all_defs.cpp:1367
constexpr struct elc::defs::base::null_ptr_n::null_ptr_t null_ptr
void the_get_null_ptr() noexcept=delete
constexpr size_t find_first_not_of_size_t(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2667
constexpr T * base_find_last_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2607
constexpr T * find_last_of_bitmark(const bitmark_for_finds< T > &mark, array_like_view_t< T >range)
Definition: all_defs.cpp:2598
constexpr T * in_range_but_reverse(T &pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2471
constexpr T * find_last_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2617
constexpr T * base_find_first_not_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2647
constexpr T * find_first_not_of_bitmark(const bitmark_for_finds< T > &mark, array_like_view_t< T >range)
Definition: all_defs.cpp:2637
constexpr size_t find_last_not_of_size_t(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2707
constexpr T * base_find_last_not_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2687
constexpr size_t find_last_of_size_t(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2627
constexpr T * find_first_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2578
constexpr size_t in_range_but_reverse_size_t(T &pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2480
constexpr size_t find_first_of_size_t(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2588
constexpr T * find_first_of_bitmark(const bitmark_for_finds< T > &mark, array_like_view_t< T >range)
Definition: all_defs.cpp:2558
constexpr T * base_find_first_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2568
constexpr T * find_last_not_of_bitmark(const bitmark_for_finds< T > &mark, array_like_view_t< T >range)
Definition: all_defs.cpp:2677
static constexpr size_t npos
Definition: all_defs.cpp:2414
constexpr bool in_range(T pattern, const range_t< T >range) noexcept(noexcept((bool((::std::declval< T >())>=(::std::declval< const T >()) &&(::std::declval< T >())<=(::std::declval< const T >())))))
Definition: all_defs.cpp:2290
constexpr size_t in_range_size_t(T &pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2426
constexpr T * find_first_not_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2657
constexpr T * find_last_not_of(array_like_view_t< T >pattern, array_like_view_t< T >range)
Definition: all_defs.cpp:2697
string_view_t< char_t > string_view
Definition: all_defs.cpp:2903
constexpr struct elc::defs::base::compare_t compare
hash_n::unstable_hash_value_t unstable_hash_t
Definition: all_defs.cpp:2235
constexpr struct elc::defs::base::equal_t equal
void just_a_use(T &&)
Definition: all_defs.cpp:928
static void destroy(T *a) noexcept
Definition: all_defs.cpp:935
auto & assign(T &&a, U &&b) noexcept(noexcept((a=b)))
Definition: all_defs.cpp:920
constexpr bool is_all_byte_zero(T &&a)
Definition: all_defs.cpp:3221
auto template_warning_helper(U &&a) noexcept
Definition: all_defs.cpp:390
::std::remove_cvref_t< T > remove_cvref
Definition: all_defs.cpp:426
constexpr struct elc::defs::base::zero_t zero
constexpr T down_cast(U a) noexcept
Definition: all_defs.cpp:977
constexpr logical_bool neither
Definition: all_defs.cpp:3198
constexpr struct elc::defs::base::just_an_part_t just_an_part
constexpr struct elc::defs::base::min_t min
constexpr struct elc::defs::base::special_init_t special_init
constexpr auto is_eq(T &&a, T &&b) noexcept(noexcept((&a==&b)))
Definition: all_defs.cpp:1516
void the_destroy() noexcept=delete
constexpr ptrdiff_t get_off_set(note::from_t< const_pointer >a, note::to_t< const_pointer >b) noexcept
Definition: all_defs.cpp:2038
constexpr bool template_error_helper
Definition: all_defs.cpp:384
constexpr auto unapply_off_set(T *b, ptrdiff_t c) noexcept
Definition: all_defs.cpp:2048
constexpr byte * cast_to_data(T *p)
Definition: all_defs.cpp:1948
constexpr struct elc::defs::base::end_by_zero_t end_by_zero
::std::remove_reference_t< T > remove_ref
Definition: all_defs.cpp:430
constexpr type_info_t< T > type_info
Definition: all_defs.cpp:1246
constexpr logical_bool either
Definition: all_defs.cpp:3198
constexpr auto pointer_to_bool(T *a) noexcept
Definition: all_defs.cpp:2011
constexpr auto pointer_equal(T *a, T *b) noexcept
Definition: all_defs.cpp:2022
decltype(nullptr) nullptr_t
Definition: all_defs.cpp:1401
constexpr struct elc::defs::base::never_ref_num_zero_t never_ref_num_zero
size_t the_number_of(type_info_t< T >) noexcept
Definition: all_defs.cpp:3254
::std::remove_cv_t< T > remove_cv
Definition: all_defs.cpp:428
constexpr struct elc::defs::base::max_t max
::std::conditional_t< B, T, F > conditional
Definition: all_defs.cpp:432
hash_n::hash_value_t hash_t
Definition: all_defs.cpp:2234
decltype(null_ptr) null_ptr_t
Definition: all_defs.cpp:1400
constexpr T & data_cast(byte *p)
Definition: all_defs.cpp:1942
constexpr const T add_const(T a) noexcept
Definition: all_defs.cpp:962
requires ::std::is_integral_v< T > constexpr size_t number_of_possible_values_per
Definition: all_defs.cpp:1930
auto & attribute_cast(T &t) noexcept
Definition: all_defs.cpp:1095
constexpr auto apply_off_set(T *a, ptrdiff_t c) noexcept
Definition: all_defs.cpp:2043
constexpr bool full_equal_in_byte(const T &a, const T &b)
Definition: all_defs.cpp:1990
constexpr bool operator==(const type_info_t< T > &, const type_info_t< T > &)
Definition: all_defs.cpp:1249
T * get_handle(attribute< T, attribute_name > *a) noexcept
Definition: all_defs.cpp:1072
auto attribute_ptr_cast(T *ptr) noexcept
Definition: all_defs.cpp:1082
constexpr logical_bool unknown
Definition: all_defs.cpp:3198
void the_pointer_equal() noexcept=delete
constexpr invoke_t< T > invoke
Definition: all_defs.cpp:3285
constexpr T & remove_const(const T &a) noexcept
Definition: all_defs.cpp:968
constexpr bool is_pointer
Definition: all_defs.cpp:2031
void the_pointer_to_bool() noexcept=delete
void discard(T &&)
Definition: all_defs.cpp:926
constexpr size_t bitnumof
Definition: all_defs.cpp:1935
constexpr auto is_not_eq(T &&a, T &&b) noexcept(noexcept((!is_eq(a, b))))
Definition: all_defs.cpp:1520
const void * const_pointer
Definition: all_defs.cpp:2035
default_func_data_t< Ret_t(Args_t...)> default_func_data
Definition: all_defs.cpp:9218
base_function_t(T) -> base_function_t< Func_t, promise_nothrow_at_destruct >
bool was_an(const_ptr p) noexcept
Definition: all_defs.cpp:13624
map_t< ptr, T > long_term_binary_node_storager
Definition: all_defs.cpp:13701
value eval(ptr p)
Definition: all_defs.cpp:13722
const T & const_use_by_ref_as(const_ptr p) noexcept
Definition: all_defs.cpp:13666
comn_ptr_t< const node_like > const_ptr
Definition: all_defs.cpp:12723
constexpr bool as_value_nothrow_helper() noexcept
Definition: all_defs.cpp:12809
value cdr_of(ptr p)
Definition: all_defs.cpp:13397
decltype(auto) as_value(T &&a) noexcept(as_value_nothrow_helper< T >())
Definition: all_defs.cpp:12822
ptr make_binary_node_from(T a) noexcept
Definition: all_defs.cpp:13697
weak_ptr_t< const node_like > const_weak_ptr
Definition: all_defs.cpp:12724
T use_as(const_ptr p) noexcept
Definition: all_defs.cpp:13685
comn_ptr_t< node_like > ptr
Definition: all_defs.cpp:12721
ptr make_long_term_binary_node_from(T a) noexcept
Definition: all_defs.cpp:13703
value car_of(ptr p)
Definition: all_defs.cpp:13394
weak_ptr_t< node_like > weak_ptr
Definition: all_defs.cpp:12722
decltype(auto) as_ptr(T &&a) noexcept(as_ptr_nothrow_helper< T >())
Definition: all_defs.cpp:12775
ptr make_list() noexcept
Definition: all_defs.cpp:13445
elc::defs::core::nil_t nil
T & use_by_ref_as(ptr p) noexcept
Definition: all_defs.cpp:13662
elc::defs::core::t_t t
maybe_fail_reference< T > maybe_fail_use_by_ref_as(ptr p) noexcept
Definition: all_defs.cpp:13643
library_handle_t get_library_handle_form_symbol(function_t< Func_t > symbol) noexcept
Definition: all_defs.cpp:21731
comn_ptr_t< library_info_t > library_handle_t
Definition: all_defs.cpp:21632
library_handle_t load_lib(string lib_name) noexcept
Definition: all_defs.cpp:21727
string get_symbol_name_form_symbol(function_t< Func_t > symbol) noexcept
Definition: all_defs.cpp:21739
charT toupper(charT c)
Definition: all_defs.cpp:4802
charT tolower(charT c)
Definition: all_defs.cpp:4803
constexpr auto ending_of_expr_beyond_expectations
Definition: all_defs.cpp:5108
constexpr auto core_runtime_internal_helper_leak
Definition: all_defs.cpp:5105
constexpr auto empty_gc_method
Definition: all_defs.cpp:5094
const ::std::locale default_locale
Definition: all_defs.cpp:4789
thread_local ptrdiff_t off_set
Definition: all_defs.cpp:7943
void * get_ptr_after_off_set(void *a) noexcept
Definition: all_defs.cpp:7946
thread_local pointer base_ptr
Definition: all_defs.cpp:7942
void is_base_ptr(void *a) noexcept
Definition: all_defs.cpp:7944
void is_instance_ptr(void *a) noexcept
Definition: all_defs.cpp:7945
void * alloc_method(type_info_t< T >) noexcept
Definition: all_defs.cpp:7011
size_t get_size_of_alloc_method(const T *arg) noexcept
Definition: all_defs.cpp:7024
size_t base_get_size_of_alloc(const byte *arg, size_t align) noexcept
Definition: all_defs.cpp:7003
void * realloc_method(T *&ptr, size_t new_size) noexcept
Definition: all_defs.cpp:7033
byte * base_aligned_alloc(size_t align, size_t size) noexcept
Definition: all_defs.cpp:6977
byte * base_realloc(byte *ptr, size_t nsize, size_t align) noexcept
Definition: all_defs.cpp:6963
void base_free(byte *p, size_t align) noexcept
Definition: all_defs.cpp:6987
constexpr alloc_t< T > alloc
Definition: all_defs.cpp:7125
constexpr struct elc::defs::memory::alloc_n::get_size_of_alloc_t get_size_of_alloc
void the_alloc_method() noexcept=delete
void the_free_method() noexcept=delete
constexpr struct elc::defs::memory::alloc_n::free_t free
void the_realloc_method() noexcept=delete
constexpr struct elc::defs::memory::alloc_n::realloc_t realloc
void the_get_size_of_alloc_method() noexcept=delete
void gc_method_of() noexcept
Definition: all_defs.cpp:10766
bool gc_success_identifier_of() noexcept
Definition: all_defs.cpp:10770
void gc_for_alloc() noexcept
Definition: all_defs.cpp:10807
size_t forward_alloc_size_grow_with_insert_uninitialized_data(T *&arg, size_t to_size, size_t insert_pos, size_t insert_size) noexcept(move.trivial< T > or move.nothrow< T >)
Definition: all_defs.cpp:7473
constexpr struct elc::defs::memory::get_n::copy_get_t copy_get
constexpr struct elc::defs::memory::get_n::get_resize_t get_resize
constexpr struct elc::defs::memory::get_n::unget_t unget
void forward_alloc_size_cut(T *&arg, size_t to_size) noexcept(move.trivial< T > or move.nothrow< T >)
Definition: all_defs.cpp:7417
void alloc_size_cut(T *&arg, size_t to_size) noexcept
Definition: all_defs.cpp:7325
void alloc_size_grow(T *&arg, size_t to_size) noexcept(move.trivial< T > or move.nothrow< T >)
Definition: all_defs.cpp:7330
constexpr struct elc::defs::memory::get_n::get_size_of_get_t get_size_of_get
constexpr get_t< T > get
Definition: all_defs.cpp:7608
void forward_alloc_size_grow(T *&arg, size_t to_size) noexcept(move.trivial< T > or move.nothrow< T >)
Definition: all_defs.cpp:7443
void alloc_size_grow_with_insert_uninitialized_data(T *&arg, size_t insert_pos, size_t insert_size) noexcept(move.trivial< T > or move.nothrow< T >)
Definition: all_defs.cpp:7353
constexpr bool copy_construct_nothrow
Definition: all_defs.cpp:5569
constexpr bool destruct_trivial
Definition: all_defs.cpp:5562
constexpr bool move_assign_trivial
Definition: all_defs.cpp:5596
constexpr bool move_assign_able
Definition: all_defs.cpp:5592
constexpr struct elc::defs::memory::lifetime_n::move_construct_t move_construct
constexpr bool move_construct_nothrow
Definition: all_defs.cpp:5577
T * super_speed_trivial_copy_from_one(T *to, const T &value, size_t size) noexcept
Definition: all_defs.cpp:5600
constexpr bool destruct_nothrow
Definition: all_defs.cpp:5560
constexpr bool copy_assign_able
Definition: all_defs.cpp:5584
constexpr struct elc::defs::memory::lifetime_n::copy_assign_t copy_assign
constexpr bool construct_nothrow
Definition: all_defs.cpp:5552
constexpr bool copy_construct_able
Definition: all_defs.cpp:5567
constexpr bool copy_construct_trivial
Definition: all_defs.cpp:5571
constexpr bool construct_trivial
Definition: all_defs.cpp:5554
constexpr bool move_assign_nothrow
Definition: all_defs.cpp:5594
constexpr struct elc::defs::memory::lifetime_n::destruct_t destruct
constexpr struct elc::defs::memory::lifetime_n::copy_construct_t copy_construct
constexpr bool move_construct_trivial
Definition: all_defs.cpp:5579
constexpr bool copy_assign_trivial
Definition: all_defs.cpp:5588
constexpr construct_t< T > construct
Definition: all_defs.cpp:5724
constexpr struct elc::defs::memory::lifetime_n::move_t move
constexpr bool copy_assign_nothrow
Definition: all_defs.cpp:5586
constexpr bool move_construct_able
Definition: all_defs.cpp:5575
constexpr struct elc::defs::memory::lifetime_n::copy_t copy
void destroy_and_free(T *a) noexcept
Definition: all_defs.cpp:8159
void the_destroy_and_free() noexcept=delete
link_num_t get_ref_num(const T *a) noexcept
Definition: all_defs.cpp:8177
void waiting_for_destroy(T *a) noexcept
Definition: all_defs.cpp:8151
constexpr bool was_weak_ref_able
Definition: all_defs.cpp:8174
void map_and_mark_for_gc() noexcept=delete
void the_waiting_for_destroy() noexcept=delete
::std::size_t link_num_t
Definition: all_defs.cpp:8123
link_num_t get_weak_ref_num(const T *a) noexcept
Definition: all_defs.cpp:8183
constexpr bool was_ref_able
Definition: all_defs.cpp:8172
void map_all(func_t &&a) noexcept(noexcept(((::std::declval< func_t >())((::std::declval< T * >())))))
Definition: all_defs.cpp:8698
void map_all_helper(func_t &&a)
Definition: all_defs.cpp:8689
null_string_data_t< char_T > null_string_data
Definition: all_defs.cpp:15252
string_t(const char_T *) -> string_t< char_T >
string_t< char_t > string
Definition: all_defs.cpp:12731
value arec_as_value(string_t< char_T > &str, const value index)
Definition: all_defs.cpp:19584
bool file_exists(const string &name) noexcept
Definition: all_defs.cpp:24009
string get_system_drive() noexcept
Definition: all_defs.cpp:24035
string get_elc_runtime_lib_path() noexcept
Definition: all_defs.cpp:24047
string get_program_data_path() noexcept
Definition: all_defs.cpp:24023
constexpr auto package_symbol_loader_file_name
Definition: all_defs.cpp:24072
string elc_runtime_lib_path
Definition: all_defs.cpp:24075
string package_symbol_loader_path
Definition: all_defs.cpp:24076
Definition: all_defs.cpp:64
int64_t int_t
Definition: all_defs.cpp:68
long double float_size_t
Definition: all_defs.cpp:74
char32_t char_t
Definition: all_defs.cpp:66
double float_t
Definition: all_defs.cpp:72
uint64_t uint_t
Definition: all_defs.cpp:70
constexpr source_location_guard(size_t lookup=0) noexcept
Definition: all_defs.cpp:3932
constexpr const char * file() noexcept
Definition: all_defs.cpp:3935
constexpr uint_least32_t line() noexcept
Definition: all_defs.cpp:3936
static constexpr size_t get_length_of(T *ptr)
Definition: all_defs.cpp:1887
constexpr size_t size() const noexcept
Definition: all_defs.cpp:1860
constexpr const_iterator c_str() const noexcept
Definition: all_defs.cpp:1859
constexpr const_iterator begin() const noexcept
Definition: all_defs.cpp:1864
constexpr T & operator[](size_t pos) noexcept
Definition: all_defs.cpp:1872
constexpr array_like_view_t(T *a, size_t b) noexcept
Definition: all_defs.cpp:1849
constexpr const T & operator[](size_t pos) const noexcept
Definition: all_defs.cpp:1873
constexpr array_like_view_t(const this_t &) noexcept=default
constexpr auto operator<=>(this_t a) noexcept(compare.nothrow< T >)
Definition: all_defs.cpp:1875
constexpr bool empty() const noexcept
Definition: all_defs.cpp:1870
constexpr auto operator==(this_t a) noexcept(equal.nothrow< T >)
Definition: all_defs.cpp:1878
constexpr array_like_view_t(U &&a) noexcept(noexcept((begin_of_array_like< T >(a), size_of_array_like< T >(a))))
Definition: all_defs.cpp:1851
void swap_with(this_t &b) noexcept(noexcept((swap(_begin, b._begin), swap(_size, b._size))))
Definition: all_defs.cpp:1854
constexpr const_iterator cbegin() const noexcept
Definition: all_defs.cpp:1867
constexpr const_iterator end() const noexcept
Definition: all_defs.cpp:1865
constexpr const_iterator cend() const noexcept
Definition: all_defs.cpp:1868
friend const U * get_handle(const attribute< U, another_attribute_name > *) noexcept
friend U * get_handle(attribute< U, another_attribute_name > *) noexcept
constexpr const T * get_handle() const noexcept
Definition: all_defs.cpp:1069
constexpr T * get_handle() noexcept
Definition: all_defs.cpp:1065
constexpr base_type_info_t(const base_type_info_t &) noexcept=default
constexpr base_type_info_t(const ::std::type_info &a) noexcept
Definition: all_defs.cpp:1159
bool operator==(const base_type_info_t &a) const noexcept
Definition: all_defs.cpp:1165
size_t get_hash() const noexcept
Definition: all_defs.cpp:1162
bool operator==(const ::std::type_info &a) const noexcept
Definition: all_defs.cpp:1166
type_name_t get_name() const noexcept
Definition: all_defs.cpp:2983
constexpr auto operator()(T *a, size_t size1, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1616
constexpr auto reverse(strong_ordering odr) const noexcept
Definition: all_defs.cpp:1744
constexpr auto operator()(T(&a)[N1], U(&b)[N2]) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1599
constexpr auto reverse(partial_ordering odr) const noexcept
Definition: all_defs.cpp:1728
constexpr auto operator()(T *a, size_t size1, U *b, size_t size2) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1608
constexpr auto reverse(weak_ordering odr) const noexcept
Definition: all_defs.cpp:1736
decltype(base_call((::std::declval< T >()),(::std::declval< U >()))) type
Definition: all_defs.cpp:1584
constexpr auto lexicographical(T *a, size_t size1, just_an_part_t, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1716
constexpr auto operator()(T *a, U *b, size_t size) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1591
constexpr auto operator()(T *a, size_t size1, just_an_part_t, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1654
constexpr auto lexicographical(T *a, size_t size1, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1678
constexpr auto operator()(T &&a, U &&b) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1587
constexpr auto lexicographical(T(&a)[N1], U(&b)[N2]) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1674
constexpr auto lexicographical(T *a, size_t size1, U *b, size_t size2) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1667
static constexpr bool able
Definition: all_defs.cpp:1557
constexpr auto operator()(T *a, end_by_zero_t, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1642
constexpr auto operator()(T *a, end_by_zero_t, U *b, size_t size2) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1629
static constexpr bool nothrow
Definition: all_defs.cpp:1564
constexpr auto lexicographical(T *a, end_by_zero_t, U *b, size_t size2) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1691
static constexpr auto base_call(T &&a, U &&b) noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1573
constexpr auto lexicographical(T *a, end_by_zero_t, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1704
constexpr cons_t()=default
constexpr constexpr_str_t_literal_helper(const char_T(&str)[N]) noexcept
Definition: all_defs.cpp:3059
range_n::bitmark_for_finds< const char_T > bitmark_for_finds
Definition: all_defs.cpp:3044
range_n::reverse_match_pattern< const char_T > reverse_match_pattern
Definition: all_defs.cpp:3043
constexpr constexpr_str_t(const char_T *str, size_t size)
Definition: all_defs.cpp:3046
range_n::match_pattern< const char_T > match_pattern
Definition: all_defs.cpp:3042
constexpr constexpr_str_t(const char_T *str)
Definition: all_defs.cpp:3053
constexpr hash_t hash() const noexcept
Definition: all_defs.cpp:3054
constexpr constexpr_str_view_t substr(const char_T *begin) const noexcept
Definition: all_defs.cpp:3030
constexpr const char_T * data() const noexcept
Definition: all_defs.cpp:3015
constexpr constexpr_str_view_t substr(size_t pos, size_t len) const noexcept
Definition: all_defs.cpp:3018
constexpr constexpr_str_view_t substr(const char_T *begin, size_t len) const noexcept
Definition: all_defs.cpp:3027
constexpr const char_T * str() const noexcept
Definition: all_defs.cpp:3014
constexpr constexpr_str_view_t substr(size_t pos, const char_T *end) const noexcept
Definition: all_defs.cpp:3024
constexpr constexpr_str_view_t substr(size_t pos) const noexcept
Definition: all_defs.cpp:3021
constexpr_str_view_t(const char_T *str) noexcept=delete
constexpr constexpr_str_view_t substr(const char_T *begin, const char_T *end) const noexcept
Definition: all_defs.cpp:3033
constexpr data_view(T *p)
Definition: all_defs.cpp:1977
constexpr bool operator()(T *a, end_by_zero_t, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1492
constexpr bool operator()(T *a, U *b, size_t size) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1454
constexpr bool operator()(T *a, size_t size1, just_an_part_t, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1503
constexpr bool operator()(T *a, size_t size1, U *b, end_by_zero_t) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1478
static constexpr bool able
Definition: all_defs.cpp:1445
constexpr bool operator()(T *a, end_by_zero_t, U *b, size_t size2) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1488
constexpr bool operator()(T *a, size_t size1, U *b, size_t size2) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1471
static constexpr bool nothrow
Definition: all_defs.cpp:1447
constexpr bool operator()(T(&a)[N1], U(&b)[N2]) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1462
constexpr auto operator()(T &&a, U &&b) const noexcept(nothrow< T, U >)
Definition: all_defs.cpp:1450
Ret_t operator()(Args_t...args) const noexcept(nothrow||invoke< const T >.nothrow< Args_t... >)
Definition: all_defs.cpp:6742
decltype(function_type_getter_conditional_helper< T >()) ::template type type
Definition: all_defs.cpp:6706
constexpr hash_base_t get_hash_in_base_type(const T &a) const noexcept(nothrow< T >)
Definition: all_defs.cpp:2161
constexpr hash_value_t repeat_times(hash_value_t value, size_t size) const noexcept
Definition: all_defs.cpp:2177
constexpr hash_value_t repeat_times(T &&value, size_t size) const noexcept
Definition: all_defs.cpp:2208
constexpr hash_value_t with_calculated_before(hash_value_t before, size_t before_size, const T *a, size_t size) const noexcept
Definition: all_defs.cpp:2167
hash_value_t merge_array_hash_results(hash_value_t before, size_t before_size, hash_value_t after, size_t after_size) const noexcept
Definition: all_defs.cpp:2216
constexpr hash_value_t with_calculated_before(hash_value_t before, size_t before_size, const array_like_view_t< T >a) const noexcept
Definition: all_defs.cpp:2226
static constexpr bool nothrow_helper() noexcept
Definition: all_defs.cpp:2095
static constexpr bool able_helper() noexcept
Definition: all_defs.cpp:2114
constexpr hash_base_t operator%(auto &&a) const noexcept
Definition: all_defs.cpp:2068
constexpr bool operator==(const hash_value_t &a) const noexcept
Definition: all_defs.cpp:2071
unstable_hash_value_t(const hash_value_t &a) noexcept
Definition: all_defs.cpp:2076
auto _as(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:3280
base_iterator_t< value_t, base_t_w > this_t
Definition: all_defs.cpp:6520
constexpr this_t operator+(ptrdiff_t num) const noexcept(noexcept((this_t(--(::std::declval< this_t & >())),++(::std::declval< this_t & >()))))
Definition: all_defs.cpp:6536
constexpr this_t operator-(ptrdiff_t num) const noexcept(noexcept(((::std::declval< this_t & >())+0)))
Definition: all_defs.cpp:6550
constexpr this_t operator++(int) &noexcept(noexcept((this_t(++(::std::declval< this_t & >())))))
Definition: all_defs.cpp:6534
constexpr this_t & operator--() &noexcept(is_before_getter_noexcept())
Definition: all_defs.cpp:6533
constexpr this_t & operator++() &noexcept(is_next_getter_noexcept())
Definition: all_defs.cpp:6532
same_base_t< value_t, base_t_w > base_t
Definition: all_defs.cpp:6521
constexpr this_t & operator=(const base_t_rw &a) &noexcept(copy_assign.nothrow< base_t_rw >)
Definition: all_defs.cpp:6530
constexpr this_t & operator=(base_t_rw &&a) &noexcept(move_assign.nothrow< base_t_rw >)
Definition: all_defs.cpp:6531
constexpr this_t operator--(int) &noexcept(noexcept((this_t(--(::std::declval< this_t & >())))))
Definition: all_defs.cpp:6535
constexpr reverse_base_t(build_base_t_T &&a) noexcept(construct< base_t_rw >.nothrow< build_base_t_T >)
Definition: all_defs.cpp:6370
auto get_handle() noexcept(noexcept(((::std::declval< base_t_w >()).get_handle())))
Definition: all_defs.cpp:6373
auto get_next() noexcept(noexcept(((::std::declval< base_t_w >()).get_before())))
Definition: all_defs.cpp:6372
auto get_before() noexcept(noexcept(((::std::declval< base_t_w >()).get_next())))
Definition: all_defs.cpp:6371
constexpr logical_bool(bool a)
Definition: all_defs.cpp:3177
constexpr logical_bool(const logical_bool &)=default
constexpr logical_bool(special_init_t, bool is_true, bool is_false, bool is_unknown=0)
Definition: all_defs.cpp:3176
friend logical_bool operator&&(logical_bool a, logical_bool b) noexcept
Definition: all_defs.cpp:3186
constexpr logical_bool operator!() const
Definition: all_defs.cpp:3181
friend logical_bool operator||(logical_bool a, logical_bool b) noexcept
Definition: all_defs.cpp:3189
constexpr logical_bool & operator=(const logical_bool &) &=default
friend logical_bool operator==(logical_bool a, logical_bool b) noexcept
Definition: all_defs.cpp:3192
constexpr auto operator()(::std::initializer_list< T >l) const
Definition: all_defs.cpp:1330
constexpr auto operator()(Args &&...rest) const
Definition: all_defs.cpp:1326
constexpr auto operator()(type_info_t< T >) const
Definition: all_defs.cpp:1334
constexpr auto operator()(::std::initializer_list< T >l) const
Definition: all_defs.cpp:1302
constexpr auto operator()(Args &&...rest) const
Definition: all_defs.cpp:1298
constexpr auto operator()(type_info_t< T >) const
Definition: all_defs.cpp:1306
constexpr non_copy_assign_able() noexcept=default
constexpr non_copy_construct_able(non_copy_construct_able &&)=default
constexpr non_copy_construct_able(const non_copy_construct_able &)=delete
constexpr non_move_assign_able() noexcept=default
constexpr non_move_construct_able(const non_move_construct_able &)=default
constexpr non_move_construct_able(non_move_construct_able &&)=delete
constexprauto base_get() const noexcept
Definition: all_defs.cpp:1386
constexpr bool mark(array_like_view_t< T >pattern) noexcept
Definition: all_defs.cpp:2534
constexpr bool operator[](T &index) const noexcept
Definition: all_defs.cpp:2548
constexpr T * match(array_like_view_t< T >range) const noexcept
Definition: all_defs.cpp:2332
constexpr void build_table(array_like_view_t< T >pattern) noexcept
Definition: all_defs.cpp:2314
constexpr match_pattern(array_like_view_t< T >pattern) noexcept
Definition: all_defs.cpp:2329
static constexpr index_type get_index_of(T &ch) noexcept
Definition: all_defs.cpp:2311
constexpr range_t(note::from_t< const T >begin, note::to_t< const T >end)
Definition: all_defs.cpp:2260
constexpr auto end() noexcept
Definition: all_defs.cpp:2266
constexpr auto begin() noexcept
Definition: all_defs.cpp:2267
constexpr range_t(note::to_t< const T >end, note::from_t< const T >begin)
Definition: all_defs.cpp:2261
constexpr range_t(const T begin, note::size_t< const T >size)
Definition: all_defs.cpp:2262
constexpr size_t size() noexcept
Definition: all_defs.cpp:2265
constexpr auto begin() const noexcept
Definition: all_defs.cpp:2269
constexpr auto end() const noexcept
Definition: all_defs.cpp:2268
constexpr range_t(const T begin, note::size_t< size_t >size)
Definition: all_defs.cpp:2263
constexpr range_t(const T begin, const T end)
Definition: all_defs.cpp:2259
constexpr T * match(array_like_view_t< T >range) const noexcept
Definition: all_defs.cpp:2388
constexpr reverse_match_pattern(array_like_view_t< T >pattern) noexcept
Definition: all_defs.cpp:2385
static constexpr index_type get_index_of(T &ch) noexcept
Definition: all_defs.cpp:2367
constexpr void build_table(array_like_view_t< T >pattern) noexcept
Definition: all_defs.cpp:2370
constexpr string_view_t substr(const char_T *begin) const noexcept
Definition: all_defs.cpp:2840
constexpr const char_T * str() const noexcept
Definition: all_defs.cpp:2824
constexpr size_t find_last_not_of(const constexpr_str_t< char_T > &str) const
Definition: all_defs.cpp:2899
constexpr size_t find_first_not_of(string_view_t str) const
Definition: all_defs.cpp:2884
constexpr size_t reverse_find(string_view_t str) const
Definition: all_defs.cpp:2856
constexpr size_t find_last_not_of(string_view_t str) const
Definition: all_defs.cpp:2887
constexpr size_t find_last_of(const constexpr_str_t< char_T > &str) const
Definition: all_defs.cpp:2893
array_like_view_t< const char_T > base_t
Definition: all_defs.cpp:2819
constexpr size_t find_first_of(string_view_t str) const
Definition: all_defs.cpp:2878
constexpr string_view_t substr(const char_T *begin, size_t len) const noexcept
Definition: all_defs.cpp:2837
constexpr size_t reverse_find(const char_T ch) const
Definition: all_defs.cpp:2850
constexpr string_view_t(const char_T *str) noexcept
Definition: all_defs.cpp:2822
constexpr size_t find_first_not_of(const constexpr_str_t< char_T > &str) const
Definition: all_defs.cpp:2896
constexpr size_t find_last_of(const char_T ch) const
Definition: all_defs.cpp:2869
constexpr size_t find_last_of(string_view_t str) const
Definition: all_defs.cpp:2881
constexpr string_view_t substr(const char_T *begin, const char_T *end) const noexcept
Definition: all_defs.cpp:2843
constexpr size_t reverse_find(const constexpr_str_t< char_T > &str) const
Definition: all_defs.cpp:2862
constexpr size_t find(string_view_t str) const
Definition: all_defs.cpp:2853
constexpr string_view_t substr(size_t pos) const noexcept
Definition: all_defs.cpp:2831
constexpr size_t find_first_not_of(const char_T ch) const
Definition: all_defs.cpp:2872
constexpr string_view_t substr(size_t pos, size_t len) const noexcept
Definition: all_defs.cpp:2828
constexpr string_view_t substr(size_t pos, const char_T *end) const noexcept
Definition: all_defs.cpp:2834
constexpr size_t find_first_of(const constexpr_str_t< char_T > &str) const
Definition: all_defs.cpp:2890
constexpr size_t find(const constexpr_str_t< char_T > &str) const
Definition: all_defs.cpp:2859
constexpr size_t find_first_of(const char_T ch) const
Definition: all_defs.cpp:2866
constexpr size_t find_last_not_of(const char_T ch) const
Definition: all_defs.cpp:2875
constexpr size_t find(const char_T ch) const
Definition: all_defs.cpp:2847
constexpr const char_T * data() const noexcept
Definition: all_defs.cpp:2825
type_name_t get_name() const noexcept
Definition: all_defs.cpp:2990
static constexpr bool not_has_has_attribute_helper()
Definition: all_defs.cpp:1206
constexpr bool operator==(const ::std::type_info &a) const noexcept
Definition: all_defs.cpp:1238
constexpr type_info_t() noexcept
Definition: all_defs.cpp:1235
constexpr type_info_t(const type_info_t &) noexcept=default
static constexpr bool has_attribute_helper()
Definition: all_defs.cpp:1198
type_name_t(const type_name_t &other) noexcept
Definition: all_defs.cpp:2969
string_view_t< char > base_t
Definition: all_defs.cpp:2924
type_name_t(const char *original_name) noexcept
Definition: all_defs.cpp:2967
static base_t demangle(const char *original_name) noexcept
Definition: all_defs.cpp:2926
type_name_t(type_name_t &&other) noexcept
Definition: all_defs.cpp:2971
static base_t copy_demangle(base_t demangled_name) noexcept
Definition: all_defs.cpp:2950
virtual base_type_info_t get_type_info() const noexcept=0
virtual Ret_t call(Args_t...) noexcept(noexcept((Ret_t()))) override final
Definition: all_defs.cpp:9210
virtual base_type_info_t get_type_info() const noexcept override final
Definition: all_defs.cpp:9211
virtual const void * get_data_begin() const noexcept override final
Definition: all_defs.cpp:9212
virtual bool equal_with(const void *) const noexcept override final
Definition: all_defs.cpp:9215
virtual bool equal_with(const void *a) const noexcept(equal.able< T >?equal.nothrow< T >:true) override final
Definition: all_defs.cpp:9183
virtual func_ptr_t get_func_ptr() const noexcept override final
Definition: all_defs.cpp:9194
virtual base_type_info_t get_type_info() const noexcept override final
Definition: all_defs.cpp:9179
function_data_warpper_t< T, Ret_t(Args_t...)> data_t
Definition: all_defs.cpp:9171
virtual const void * get_data_begin() const noexcept override final
Definition: all_defs.cpp:9180
virtual Ret_t call(Args_t...args) noexcept(invoke< T >.nothrow< Args_t... >) override final
Definition: all_defs.cpp:9189
bool operator==(const data_t &a) const noexcept(noexcept((a._value==*_m)))
Definition: all_defs.cpp:10280
auto_stack_t(base_t &&a) noexcept(noexcept((base_t(a))))
Definition: all_defs.cpp:9930
this_t & operator=(this_t &&a) &noexcept
Definition: all_defs.cpp:9932
auto_stack_t(const base_t &a) noexcept(noexcept((base_t(a))))
Definition: all_defs.cpp:9929
maybe_fail_reference< T > find(U &&a) noexcept(noexcept(((::std::declval< T & >())==a)))
Definition: all_defs.cpp:9934
bool in_stack(const T &a) const noexcept(noexcept(((::std::declval< this_t >()).find(a).not_fail())))
Definition: all_defs.cpp:9948
bool not_in_stack(const T &a) const noexcept(noexcept(((::std::declval< this_t >()).in_stack(a))))
Definition: all_defs.cpp:9951
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13512
virtual void clear() noexcept override
Definition: all_defs.cpp:13526
base_binary_function_node(function_t< void(ptr)> func) noexcept
Definition: all_defs.cpp:13496
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13509
base_binary_function_node(function_t< value(ptr)> func) noexcept
Definition: all_defs.cpp:13495
virtual value be_call(ptr arg_list) override
Definition: all_defs.cpp:13510
base_binary_function_node(function_t< void()> func) noexcept
Definition: all_defs.cpp:13502
virtual value arec(const value index) override
Definition: all_defs.cpp:13524
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13243
virtual constexpr size_t eq_level() const noexcept override
Definition: all_defs.cpp:13246
virtual constexpr size_t equal_level() const noexcept override
Definition: all_defs.cpp:13245
virtual constexpr ~base_constexpr_t() noexcept override=default
virtual void clear() noexcept override final
Definition: all_defs.cpp:13253
virtual void be_replace_as(ptr) noexcept override
Definition: all_defs.cpp:13255
virtual base_type_info_t get_type_info() const noexcept override final
Definition: all_defs.cpp:13544
virtual base_type_info_t get_additional_type_info() const noexcept=0
virtual void throw_self_ptr() override
Definition: all_defs.cpp:13582
virtual value arec(const value index) noexcept(arec_nothrow_helper) override
Definition: all_defs.cpp:13604
binary_node_t(const T &a) noexcept
Definition: all_defs.cpp:13563
virtual void throw_self_ptr() const override
Definition: all_defs.cpp:13581
virtual base_type_info_t get_additional_type_info() const noexcept override
Definition: all_defs.cpp:13566
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13597
virtual logical_bool eq_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13583
virtual void clear() noexcept(clear_nothrow_helper) override
Definition: all_defs.cpp:13615
virtual value be_eval() override
Definition: all_defs.cpp:13734
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13752
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13370
map_t< value, const_weak_ptr > _m
Definition: all_defs.cpp:13366
virtual void clear() noexcept override
Definition: all_defs.cpp:13379
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13368
virtual value arec(const value index) override
Definition: all_defs.cpp:13377
cons(ptr car, ptr cdr)
Definition: all_defs.cpp:13413
virtual value arec(const value index) override
Definition: all_defs.cpp:13427
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13420
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13418
virtual void clear() noexcept override
Definition: all_defs.cpp:13442
virtual value be_eval() override
Definition: all_defs.cpp:13472
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13475
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13308
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13306
const_ptr operator&() const noexcept
Definition: all_defs.cpp:12918
value operator()(Args &&...rest)
Definition: all_defs.cpp:12894
virtual base_type_info_t get_type_info() const noexcept=0
virtual constexpr size_t eq_level() const noexcept
Definition: all_defs.cpp:12866
virtual constexpr size_t equal_level() const noexcept
Definition: all_defs.cpp:12865
virtual void waiting_for_destroy() noexcept
Definition: all_defs.cpp:12924
virtual void be_replace_as(ptr a) noexcept
Definition: all_defs.cpp:12885
node_like() noexcept=default
virtual ~node_like()=default
virtual value arec(const value)=0
logical_bool operator==(const this_t &a) const noexcept
Definition: all_defs.cpp:12919
value operator[](auto &&index)
Definition: all_defs.cpp:12875
virtual void clear() noexcept=0
logical_bool eq(const_ptr a) const noexcept
Definition: all_defs.cpp:12896
logical_bool equal(const_ptr a) const noexcept
Definition: all_defs.cpp:12906
virtual void be_replace_as(ptr) noexcept override
Definition: all_defs.cpp:13335
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13329
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13327
virtual ~base_data_t() noexcept=default
virtual base_type_info_t get_type_info() const noexcept override final
Definition: all_defs.cpp:13037
constexpr_data_t(const constexpr_data_t &) noexcept=default
virtual ~constexpr_data_t() noexcept override final=default
virtual ptr get_value() noexcept override final
Definition: all_defs.cpp:13035
virtual base_data_t * copy() const noexcept override final
Definition: all_defs.cpp:13036
virtual ~null_data_t() noexcept override final=default
virtual base_type_info_t get_type_info() const noexcept override final
Definition: all_defs.cpp:13024
virtual ptr get_value() noexcept override final
Definition: all_defs.cpp:13022
virtual base_data_t * copy() const noexcept override final
Definition: all_defs.cpp:13023
virtual base_type_info_t get_type_info() const noexcept override final
Definition: all_defs.cpp:13050
variable_data_t(const variable_data_t &) noexcept=default
virtual ptr get_value() noexcept override final
Definition: all_defs.cpp:13048
virtual ~variable_data_t() noexcept override final=default
virtual base_data_t * copy() const noexcept override final
Definition: all_defs.cpp:13049
value(this_t &&a) noexcept=default
value(const this_t &a) noexcept=default
value(node_like *a) noexcept
Definition: all_defs.cpp:13058
auto operator!=(auto &&a) const
Definition: all_defs.cpp:13115
this_t & operator>>(this_t a) noexcept
Definition: all_defs.cpp:13096
auto operator[](T &&index)
Definition: all_defs.cpp:13102
const_ptr operator&() const
Definition: all_defs.cpp:13082
constexpr value(special_init_t) noexcept
Definition: all_defs.cpp:13056
~value() noexcept=default
void re_ref_to(this_t a) noexcept
Definition: all_defs.cpp:13093
auto operator==(auto &&a) const noexcept
Definition: all_defs.cpp:13107
value(base_data_t *a) noexcept
Definition: all_defs.cpp:13059
void ref_to(this_t a) noexcept
Definition: all_defs.cpp:13087
value(ptr a) noexcept
Definition: all_defs.cpp:13057
this_t & operator=(auto &&a)
Definition: all_defs.cpp:13069
void un_ref() noexcept
Definition: all_defs.cpp:13090
virtual constexpr size_t eq_level() const noexcept override
Definition: all_defs.cpp:13278
virtual base_type_info_t get_type_info() const noexcept override
Definition: all_defs.cpp:13275
virtual constexpr size_t equal_level() const noexcept override
Definition: all_defs.cpp:13277
virtual logical_bool equal_with(const_ptr a) const noexcept override
Definition: all_defs.cpp:13279
constexpr library_info_t(special_init_t) noexcept
Definition: all_defs.cpp:21641
void * get_symbol(string symbol_name) noexcept
Definition: all_defs.cpp:21666
symbol_t & get_symbol_as(string symbol_name) noexcept
Definition: all_defs.cpp:21670
library_info_t(string lib_name) noexcept
Definition: all_defs.cpp:21646
symbol_t(library_handle_t lib, string symbol_name, Ret_t(*self)(Args_t...) noexcept(nothrow)) noexcept
Definition: all_defs.cpp:21701
T * operator()() const noexcept
Definition: all_defs.cpp:7116
static T * base_call(size_t size) noexcept
Definition: all_defs.cpp:7106
constexpr alloc_array_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:7122
static T * base_call() noexcept
Definition: all_defs.cpp:7101
T * operator()(size_t size) const noexcept
Definition: all_defs.cpp:7117
static T * base_call(const T *arg) noexcept(nothrow< T >)
Definition: all_defs.cpp:7197
T * operator()(const T *arg) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7203
static void base_call(T *p) noexcept
Definition: all_defs.cpp:7130
void operator()(T *p) const noexcept
Definition: all_defs.cpp:7136
static size_t base_call(const T *arg) noexcept(nothrow< T >)
Definition: all_defs.cpp:7177
size_t operator()(const T *arg) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7185
constexpr realloc_array_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:7167
static void base_call(T *&ptr, size_t nsize) noexcept
Definition: all_defs.cpp:7142
void operator()(T *&ptr, size_t nsize) const noexcept
Definition: all_defs.cpp:7159
mark_able_for_gc(const mark_able_for_gc &) noexcept
Definition: all_defs.cpp:10571
static T * base_call(const T *arg) noexcept(nothrow< T >)
Definition: all_defs.cpp:7826
T * operator()(const T *arg) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7835
static void base_call(T *&arg, const size_t to_size) noexcept(nothrow< T >)
Definition: all_defs.cpp:7732
static constexpr struct elc::defs::memory::get_n::get_forward_resize_t::insert_resize_t insert_with_resize
void operator()(T *&arg, size_t to_size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7758
T * operator()(T *&&arg, size_t to_size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7762
static constexpr struct elc::defs::memory::get_n::get_resize_t::insert_resize_t insert_with_resize
static void base_call(T *&arg, const size_t to_size) noexcept(nothrow< T >)
Definition: all_defs.cpp:7652
T * operator()(T *&&arg, size_t to_size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7682
void operator()(T *&arg, size_t to_size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7677
static constexpr struct elc::defs::memory::get_n::get_resize_t::insert_t insert
static size_t base_call(const T *arg) noexcept(nothrow< T >)
Definition: all_defs.cpp:7808
size_t operator()(const T *arg) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7814
T * operator()(note::to_t< T *& > to, const T &a) const noexcept(nothrow< void >)
Definition: all_defs.cpp:7567
T * operator()(note::to_t< T *& > to, array_like_view_t< const T >a) const noexcept(nothrow< void >)
Definition: all_defs.cpp:7558
T * operator()(note::to_t< T *& > to, T &&a) const noexcept(nothrow< void >)
Definition: all_defs.cpp:7575
T * operator()(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:7526
T * operator()(array_like_view_t< const T >a) const noexcept(nothrow< void >)
Definition: all_defs.cpp:7541
bool operator()(array_like_view_t< const T >a, note::from_t< T * >from) const noexcept(nothrow< void >)
Definition: all_defs.cpp:7591
T * operator()(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:7518
constexpr array_get_t operator[](size_t size) const noexcept
Definition: all_defs.cpp:7533
void operator()(T *a) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7618
static constexpr bool nothrow
Definition: all_defs.cpp:7615
void operator()(T *a, decltype(destruct)::not_t) const noexcept(nothrow< T >)
Definition: all_defs.cpp:7639
T * operator()(const T &v) const noexcept(nothrow< const T & >)
Definition: all_defs.cpp:5667
T * operator()(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:5661
void base_call(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:5656
constexpr array_construct_t operator[](size_t size) const noexcept
Definition: all_defs.cpp:5708
void base_call(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:5686
T * operator()(Args &&...rest) const noexcept(nothrow< Args... >)
Definition: all_defs.cpp:5690
T * operator()(const T &v) const noexcept(nothrow< const T & >)
Definition: all_defs.cpp:5695
T * operator()(T *to, const T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6144
T * operator()(note::to_t< T * >to, note::from_t< const T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6148
T * operator()(const T &from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6156
T * operator()(note::from_t< const T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6152
T * operator()(note::to_t< T * >to, const T &from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6160
static T * base_call(T *to, const T &from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:6127
static T * base_call(T *to, const T *from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:6117
static T & base_call(T &a, const T &b) noexcept(nothrow< T >)
Definition: all_defs.cpp:6107
T & operator()(T &a, const T &b) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6137
constexpr array_copy_assign_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:6164
T * operator()(T *to, const T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5933
T * operator()(T *to, const T &from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5937
T * operator()(note::from_t< const T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5945
T * operator()(note::to_t< T * >to, note::from_t< const T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5941
T * operator()(T *to, const T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5879
T * operator()(note::from_t< const T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5887
static T * base_call(T *to, const T *from) noexcept(nothrow< T >)
Definition: all_defs.cpp:5853
T * operator()(T *to, const T &from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5927
static T * base_call(T *to, const T &from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:5915
T * operator()(note::to_t< T * >to, note::from_t< const T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5883
static T * base_call(T *to, const T &from) noexcept(nothrow< T >)
Definition: all_defs.cpp:5904
T * operator()(T *to, const T *from, size_t size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5892
T * operator()(note::to_t< T * >to, note::from_t< const T * >from, size_t size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5896
static T * base_call(T *to, const T *from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:5868
constexpr array_copy_construct_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:5949
T * operator()(note::from_t< const T * >from, note::to_t< T * >to, size_t size) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5900
void operator()(T *begin) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5771
static void base_call(T *to) noexcept(nothrow< T >)
Definition: all_defs.cpp:5745
constexpr array_destruct_t operator[](size_t size) const noexcept
Definition: all_defs.cpp:5776
constexpr not_t operator!() const noexcept
Definition: all_defs.cpp:5780
static void base_call(T *begin, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:5756
void operator()(T *begin) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5764
T * operator()(T *to, T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6205
T * operator()(note::from_t< T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6213
T * operator()(note::to_t< T * >to, note::from_t< T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6209
static T & base_call(T &a, T &&b) noexcept(nothrow< T >)
Definition: all_defs.cpp:6178
static T * base_call(T *to, T *from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:6187
constexpr array_move_assign_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:6217
T & operator()(T &a, T &b) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6198
T * operator()(note::to_t< T * >to, note::from_t< T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6013
T * operator()(T *to, T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6009
T * operator()(note::from_t< T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6017
constexpr array_move_construct_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:6021
T * operator()(note::to_t< T * >to, note::from_t< T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5999
static T * base_call(T *to, T *from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:5979
T * operator()(note::from_t< T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6003
static T * base_call(T *to, T *from) noexcept(nothrow< T >)
Definition: all_defs.cpp:5967
T * operator()(T *to, T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5995
T * operator()(note::to_t< T * >to, note::from_t< T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6066
T * operator()(note::from_t< T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6070
T * operator()(T *to, T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6062
T * operator()(note::from_t< T * >from, note::to_t< T * >to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6056
static T * base_call(T *to, T *from, size_t size) noexcept(nothrow< T >)
Definition: all_defs.cpp:6039
static T * base_call(T *to, T *from) noexcept(nothrow< T >)
Definition: all_defs.cpp:6033
T * operator()(note::to_t< T * >to, note::from_t< T * >from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6052
T * operator()(T *to, T *from) const noexcept(nothrow< T >)
Definition: all_defs.cpp:6048
constexpr remove_ref< T > && operator()(T &&a) const noexcept
Definition: all_defs.cpp:6078
constexpr array_move_t operator[](size_t a) const noexcept
Definition: all_defs.cpp:6074
T * operator()(Args &&...rest) const noexcept(nothrow< T, Args... >)
Definition: all_defs.cpp:5815
constexpr array_re_construct_t< T > operator[](size_t size) const noexcept
Definition: all_defs.cpp:5832
T * operator()(Args &&...rest) const noexcept(nothrow< T, Args... >)
Definition: all_defs.cpp:5827
T * operator()(T *to) const noexcept(nothrow< T >)
Definition: all_defs.cpp:5805
constexpr placement_re_construct_t< T > operator[](T *p) const noexcept
Definition: all_defs.cpp:5835
T & operator*() const noexcept(get_nothrow)
Definition: all_defs.cpp:8450
base_ptr_t & operator=(const same_ptr &a) &noexcept(reset_nothrow &&get_nothrow)
Definition: all_defs.cpp:8456
base_ptr_t & operator=(const base_ptr_t &a) &noexcept(reset_nothrow &&get_nothrow)
Definition: all_defs.cpp:8457
base_ptr_t & operator=(null_ptr_t) &noexcept(reset_nothrow)
Definition: all_defs.cpp:8460
T * operator->() const noexcept(get_nothrow)
Definition: all_defs.cpp:8449
ptr_t< T, ref_type, do_replace_check > base_t
Definition: all_defs.cpp:8432
base_ptr_t(base_ptr_t &a) noexcept
Definition: all_defs.cpp:8446
base_ptr_t & operator=(nullptr_t) &noexcept(reset_nothrow)
Definition: all_defs.cpp:8461
auto operator!() const noexcept(get_nothrow)
Definition: all_defs.cpp:8452
base_ptr_t< T, ref_type, do_replace_check > this_t
Definition: all_defs.cpp:8433
base_ptr_t & operator=(same_ref &&a) &noexcept
Definition: all_defs.cpp:8458
base_ptr_t(base_ptr_t &&a) noexcept
Definition: all_defs.cpp:8447
base_ptr_t & operator=(base_ptr_t &&a) &noexcept
Definition: all_defs.cpp:8459
base_ptr_t & operator=(T *a) &noexcept(reset_nothrow)
Definition: all_defs.cpp:8455
void do_replace(T *p) noexcept(replace_check_nothrow &&reset_nothrow)
Definition: all_defs.cpp:8361
auto operator==(nullptr_t) const noexcept(noexcept((operator==(null_ptr))))
Definition: all_defs.cpp:8387
auto operator==(const ptr_t< T, ref_type_, do_replace_check_ > &b) const noexcept(noexcept((pointer_equal((::std::declval< const this_t & >()).get(), b.get()))))
Definition: all_defs.cpp:8394
bool unique() const noexcept
Definition: all_defs.cpp:8376
constexpr ptr_t(nullptr_t=nullptr) noexcept
Definition: all_defs.cpp:8347
constexpr conditional< do_replace_check &&type_info< T >. template has_attribute_helper< replace_able >(), unstable_hash_t, hash_t > hash() const noexcept(noexcept((elc::defs::hash(get()))))
Definition: all_defs.cpp:8379
ptr_t(const same_ref &a) noexcept
Definition: all_defs.cpp:8328
constexpr ptr_t(null_ptr_t) noexcept
Definition: all_defs.cpp:8348
same_ref_p_t< T, ref_type > same_ref
Definition: all_defs.cpp:8309
ptr_t(const same_ptr &a) noexcept
Definition: all_defs.cpp:8319
void reset(T *a) const noexcept(reset_nothrow)
Definition: all_defs.cpp:8352
void replace_check() const noexcept(replace_check_nothrow)
Definition: all_defs.cpp:8356
ptr_t(ptr_t &&a) noexcept
Definition: all_defs.cpp:8331
ptr_t(T *a, special_init_t) noexcept
Definition: all_defs.cpp:8317
auto operator==(null_ptr_t) const noexcept(noexcept((operator==((T *) null_ptr))))
Definition: all_defs.cpp:8390
ptr_t(const ptr_t &a) noexcept
Definition: all_defs.cpp:8329
~ptr_t() noexcept(cut_nothrow)
Definition: all_defs.cpp:8349
void do_replace(const ptr_t< T, ref_type_, do_replace_check_ > &p) noexcept(replace_check_nothrow &&reset_nothrow)
Definition: all_defs.cpp:8368
void reset(nullptr_t=nullptr) const noexcept(reset_nothrow)
Definition: all_defs.cpp:8353
auto operator==(const T *a) const noexcept(noexcept((pointer_equal(add_const((::std::declval< const this_t & >()).get()), a))))
Definition: all_defs.cpp:8384
ptr_t< T, ref_type, do_replace_check > this_t
Definition: all_defs.cpp:8306
constexpr ptr_t(T *a) noexcept
Definition: all_defs.cpp:8318
same_ref_p_t< T, ref_type > base_t
Definition: all_defs.cpp:8308
T * get() const noexcept(get_nothrow)
Definition: all_defs.cpp:8372
ptr_t(const ptr_t< remove_cv< T >, ref_type, do_replace_check > &a) noexcept
Definition: all_defs.cpp:8330
virtual T & get() noexcept override
Definition: all_defs.cpp:10856
virtual void map_and_mark() noexcept override
Definition: all_defs.cpp:10859
same_ptr_p_t(const same_ptr_p_t &) noexcept=default
static void cut_ref(T *a) noexcept(cut_nothrow)
Definition: all_defs.cpp:8292
void swap_with(same_ref_p_t &a) noexcept
Definition: all_defs.cpp:8288
same_ref_p_t(const same_ptr_p_t< T > &a) noexcept
Definition: all_defs.cpp:8286
void cut_ref() const noexcept(noexcept((cut_ref(nullptr))))
Definition: all_defs.cpp:8295
static void add_ref(T *a) noexcept
Definition: all_defs.cpp:8293
constexpr void be_replace_as(T *new_p) noexcept
Definition: all_defs.cpp:8652
constexpr ~replace_able() noexcept
Definition: all_defs.cpp:8641
constexpr void be_replace_as(nullptr_t) noexcept
Definition: all_defs.cpp:8659
constexpr bool replaced() const noexcept
Definition: all_defs.cpp:8645
constexpr T * get_ptr() const noexcept
Definition: all_defs.cpp:8646
constexpr replace_able() noexcept
Definition: all_defs.cpp:8640
void inter_namespace(const value namespace_name)
Definition: all_defs.cpp:23352
value get_symbol_type_map(ptr thenamespace)
Definition: all_defs.cpp:23311
ptr get_symbol_namespace(auto &&index)
Definition: all_defs.cpp:23335
ptr get_symbol_namespace(const value index)
Definition: all_defs.cpp:23329
value get_symbol(const value index)
Definition: all_defs.cpp:23343
bool has_symbol(const value index)
Definition: all_defs.cpp:23336
value get_symbol_type(auto &&index)
Definition: all_defs.cpp:23350
value get_symbol_type(const value index)
Definition: all_defs.cpp:23347
function_t< ptr(string lib_name, size_t lib_ver, string symbol_name) noexcept > load_interface
Definition: all_defs.cpp:24510
size_t read(T *v, size_t size=1)
Definition: all_defs.cpp:12111
virtual size_t read(byte *buf, size_t size)=0
void write(const T *v, size_t size=1)
Definition: all_defs.cpp:12103
virtual void write(const byte *buf, size_t size)=0
virtual void seek_to(void *)=0
virtual void * seek(seek_type, int_t)=0
virtual void flush() noexcept override
Definition: all_defs.cpp:22758
virtual void sync() noexcept override
Definition: all_defs.cpp:22755
virtual void seek_to(void *p) noexcept override
Definition: all_defs.cpp:22752
virtual void close() noexcept override
Definition: all_defs.cpp:22761
size_t bufsize() const noexcept
Definition: all_defs.cpp:22734
virtual void write(const byte *buf, size_t size) noexcept override
Definition: all_defs.cpp:22766
virtual void * seek(seek_type st, int_t offsize) noexcept override
Definition: all_defs.cpp:22737
virtual size_t read(byte *buf, size_t size) noexcept override
Definition: all_defs.cpp:22773
virtual size_t read(byte *buf, size_t size) noexcept override=0
size_t read(T *v, size_t size=1) noexcept
Definition: all_defs.cpp:12137
void write(const T *v, size_t size=1) noexcept
Definition: all_defs.cpp:12130
virtual void write(const byte *buf, size_t size) noexcept override=0
virtual ~noexcept_stream() noexcept override=default
virtual void sync() noexcept override=0
virtual void seek_to(void *) noexcept override=0
virtual compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >)=0
static void be_replace(this_t *a, ptr_t b) noexcept(ptr_reset_nothrow)
Definition: all_defs.cpp:15167
compare_type compare_with(ptr_t with) noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:15001
static void be_replace(ptr_t &a, ptr_t b) noexcept(ptr_reset_nothrow)
Definition: all_defs.cpp:15170
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >)=0
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow)=0
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:14863
virtual float_size_t get_base_memory_cost() noexcept=0
hash_t get_hash(ptr_t &p) noexcept(hash_nothrow)
Definition: all_defs.cpp:15117
bool equal_with(ptr_t with) noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:14894
compare_type compare_with(ptr_t with, size_t pos, size_t size) noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:15030
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow)=0
virtual ~base_string_data_t() noexcept(destruct_nothrow)=default
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept=0
compare_type default_compare_method(ptr_t with) noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:15025
bool equal_with(const char_T *with) noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:14975
bool equal_with(ptr_t with, size_t pos, size_t size) noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:14927
hash_t get_others_hash_with_calculated_before(hash_t before, size_t before_size, ptr_t &p, size_t pos, size_t size) noexcept(hash_nothrow)
Definition: all_defs.cpp:15132
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &p, size_t pos, size_t size) noexcept(hash_nothrow)
Definition: all_defs.cpp:15138
virtual char_T * get_c_str(ptr_t &) noexcept(get_data_nothrow)
Definition: all_defs.cpp:15503
virtual hash_t get_hash_detail(ptr_t &p) noexcept(hash_nothrow)
Definition: all_defs.cpp:15126
static void equivalent_optimization(auto &&a, auto &&b) noexcept(ptr_reset_nothrow)
Definition: all_defs.cpp:15173
virtual const char_T * get_data(ptr_t &p) noexcept(get_data_nothrow)
Definition: all_defs.cpp:14843
compare_type compare_with(string_view_t with) noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:15057
virtual const range_n::reverse_match_pattern< const char_T > & get_reverse_match_pattern_from_self(ptr_t &self) noexcept(copy_assign_nothrow &&move_construct_nothrow)
Definition: all_defs.cpp:15534
virtual const range_n::match_pattern< const char_T > & get_match_pattern_from_self(ptr_t &self) noexcept(copy_assign_nothrow &&move_construct_nothrow)
Definition: all_defs.cpp:15528
bool default_equal_method(ptr_t with) noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:14922
bool equal_with(string_view_t with) noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:14954
compare_type compare_with(const char_T *with) noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:15078
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:15447
comn_string_data_t(ptr_t str, size_t pos, size_t size) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:15432
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15463
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:15480
virtual bool same_struct(ptr_t) noexcept override final
Definition: all_defs.cpp:15472
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15462
comn_string_data_t(size_t size) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:15439
virtual const range_n::reverse_match_pattern< const char_T > & get_reverse_match_pattern_from_self(ptr_t &self) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15495
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:15476
comn_string_data_t(string_view_t str) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:15423
virtual const range_n::match_pattern< const char_T > & get_match_pattern_from_self(ptr_t &self) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15489
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:15460
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:15458
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:15485
virtual char_T * get_c_str(ptr_t &) noexcept override final
Definition: all_defs.cpp:15451
comn_string_data_t(size_t size, char_T ch) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:15436
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:15475
virtual ~comn_string_data_t() noexcept(destruct_nothrow) override final
Definition: all_defs.cpp:15443
virtual char_T * get_unique_c_str(ptr_t &p) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:15452
comn_string_data_t(ptr_t str) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:15427
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:15343
virtual const range_n::match_pattern< const char_T > & get_match_pattern_from_self(ptr_t &self) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15361
virtual const char_T * get_const_c_str(ptr_t &p) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:15325
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:15340
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:15344
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:15357
virtual const char_T * get_data(ptr_t &) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:15324
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:15350
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:15331
constexpr_string_data_t(const constexpr_str_t< char_T > &str) noexcept
Definition: all_defs.cpp:15303
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:15333
virtual const range_n::reverse_match_pattern< const char_T > & get_reverse_match_pattern_from_self(ptr_t &self) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15368
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:15321
virtual ~constexpr_string_data_t() noexcept(destruct_nothrow) override final
Definition: all_defs.cpp:15317
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:15337
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept override final
Definition: all_defs.cpp:15338
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15335
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16157
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:16061
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16137
virtual ptr_t apply_str_to_end(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16153
end_apply_string_data_t(ptr_t str, size_t count) noexcept
Definition: all_defs.cpp:16041
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:16049
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:16102
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:16234
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16197
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16125
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:16225
virtual char_T * get_c_str(ptr_t &p) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:16055
virtual ptr_t do_insert(size_t pos, string_view_t str) noexcept(copy_construct_nothrow) override final
Definition: all_defs.cpp:16072
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16119
end_apply_string_data_t(ptr_t str, size_t count, char_T ch) noexcept
Definition: all_defs.cpp:16033
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16200
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:16221
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16177
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:16246
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16187
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16167
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:16240
end_apply_string_data_t(ptr_t str, string_view_t end) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:16025
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:16071
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:16711
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16629
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:16723
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16594
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:16700
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:16552
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16682
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:16561
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:16717
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:16563
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:16696
virtual ptr_t apply_str_to_end(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16639
virtual ptr_t do_erase(size_t pos, size_t size) noexcept override final
Definition: all_defs.cpp:16576
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16617
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16587
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16649
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:16544
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16661
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16673
erased_string_data_t(ptr_t str, size_t erase_pos, size_t erase_size) noexcept
Definition: all_defs.cpp:16540
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16605
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:15867
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:15771
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:15781
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:15874
head_apply_string_data_t(ptr_t str, string_view_t head) noexcept(construct_nothrow &&copy_assign_nothrow)
Definition: all_defs.cpp:15750
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:15946
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15830
void shrink() noexcept(_m.forward_resize_nothrow)
Definition: all_defs.cpp:15871
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:15968
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:15812
virtual ptr_t do_insert(size_t pos, string_view_t str) noexcept(copy_construct_nothrow) override final
Definition: all_defs.cpp:15782
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:15759
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:15960
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:15927
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:15914
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:15950
virtual ptr_t apply_str_to_end(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:15884
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:15894
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15838
virtual char_T * get_c_str(ptr_t &p) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:15765
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:15903
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:15851
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:15976
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:17041
virtual ptr_t do_insert(size_t pos, string_view_t str) noexcept(copy_construct_nothrow) override final
Definition: all_defs.cpp:16822
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16866
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:16785
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16956
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16906
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:17003
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:17025
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:16801
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16992
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:16799
inserted_string_data_t(ptr_t to, ptr_t insert_data, size_t insert_pos) noexcept
Definition: all_defs.cpp:16773
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:16775
virtual ptr_t apply_str_to_end(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16940
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16888
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t index) noexcept override final
Definition: all_defs.cpp:17029
virtual ptr_t do_erase(size_t pos, size_t size) noexcept override final
Definition: all_defs.cpp:16842
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16875
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16924
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:17047
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:17055
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16974
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:15246
virtual hash_t get_hash_detail(ptr_t &p) noexcept override final
Definition: all_defs.cpp:15242
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept override final
Definition: all_defs.cpp:15235
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:15224
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &p, size_t pos, size_t size) noexcept override final
Definition: all_defs.cpp:15243
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:15219
virtual char_T * get_c_str(ptr_t &) noexcept override final
Definition: all_defs.cpp:15220
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:15226
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept override final
Definition: all_defs.cpp:15248
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:15227
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept override final
Definition: all_defs.cpp:15238
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:15225
virtual ptr_t do_erase(size_t pos, size_t size) noexcept override final
Definition: all_defs.cpp:15233
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:15228
virtual ptr_t apply_str_to_end(ptr_t str) noexcept override final
Definition: all_defs.cpp:15229
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept override final
Definition: all_defs.cpp:15240
virtual ptr_t do_insert(size_t pos, string_view_t str) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:15231
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept override final
Definition: all_defs.cpp:15239
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:15249
virtual ptr_t do_insert(size_t pos, ptr_t str) noexcept override final
Definition: all_defs.cpp:15232
virtual char_T arec(size_t index) noexcept override final
Definition: all_defs.cpp:15237
virtual bool same_struct_equal(ptr_t with) noexcept override final
Definition: all_defs.cpp:15247
virtual bool same_struct(ptr_t) noexcept override final
Definition: all_defs.cpp:15245
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:17153
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:17171
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:17175
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:17125
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:17179
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:17121
virtual ptr_t do_pop_front(size_t size, ptr_t &) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:17131
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:17128
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:17160
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:17150
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:17116
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:17113
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:17157
virtual ptr_t do_pop_back(size_t size, ptr_t &) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:17140
substr_string_data_t(ptr_t str, size_t sub_begin, size_t sub_size) noexcept
Definition: all_defs.cpp:15582
virtual const char_T * get_const_c_str(ptr_t &p) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:15591
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:15621
virtual const char_T * get_data(ptr_t &) noexcept(get_data_nothrow) override final
Definition: all_defs.cpp:15597
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:15662
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15603
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:15696
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:15687
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:15700
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:15692
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:15674
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:15602
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:15598
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:15683
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:15611
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:15586
virtual ptr_t apply_str_to_end(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:15641
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:15631
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:15590
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:15651
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:15600
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:15679
virtual ptr_t apply_str_to_end(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16380
virtual char_T arec(size_t index) noexcept(copy_construct_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16343
virtual ptr_t do_pop_back(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16416
sum_string_data_t(ptr_t before, ptr_t after) noexcept
Definition: all_defs.cpp:16296
virtual ptr_t apply_str_to_end(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16390
virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before, size_t before_size, ptr_t &, size_t pos, size_t size) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16445
virtual bool same_struct(ptr_t with) noexcept override final
Definition: all_defs.cpp:16462
virtual ptr_t do_pop_front(size_t size, ptr_t &self) noexcept(construct_nothrow &&copy_assign_nothrow) override final
Definition: all_defs.cpp:16400
virtual ptr_t apply_str_to_begin(string_view_t str) noexcept(copy_construct_nothrow &&apply_data_nothrow) override final
Definition: all_defs.cpp:16360
virtual void be_replace_as(ptr_t a) noexcept(clear_nothrow) override final
Definition: all_defs.cpp:16311
virtual hash_t get_hash_detail(ptr_t &) noexcept(hash_nothrow) override final
Definition: all_defs.cpp:16433
virtual bool same_struct_equal(ptr_t with) noexcept(equal.nothrow< char_T >) override final
Definition: all_defs.cpp:16472
virtual ptr_t apply_str_to_begin(ptr_t str) noexcept(apply_data_nothrow) override final
Definition: all_defs.cpp:16370
virtual base_t::compare_type same_struct_compare(ptr_t with) noexcept(compare.nothrow< char_T >) override final
Definition: all_defs.cpp:16478
virtual range_t< const char_T * > get_the_largest_complete_data_block_begin_form(size_t begin) noexcept override final
Definition: all_defs.cpp:16466
virtual float_size_t get_base_memory_cost() noexcept override final
Definition: all_defs.cpp:16484
virtual void arec_set(size_t index, char_T a, ptr_t &p) noexcept(copy_assign_nothrow &&move_construct_nothrow) override final
Definition: all_defs.cpp:16349
virtual size_t get_size() noexcept override final
Definition: all_defs.cpp:16325
virtual void copy_part_data_to(char_T *to, size_t pos, size_t size) noexcept(copy_assign_nothrow) override final
Definition: all_defs.cpp:16327
virtual ptr_t get_substr_data(size_t begin, size_t size) noexcept override final
Definition: all_defs.cpp:16303
void push_front(string_view_t str) &noexcept
Definition: all_defs.cpp:17737
string_t & operator=(string_t &&str) noexcept
Definition: all_defs.cpp:17344
size_t find(const string_t &str, size_t begin=0) const noexcept(find_nothrow)
Definition: all_defs.cpp:17775
constexpr bool ends_with(const char_T *str) const noexcept
Definition: all_defs.cpp:18032
void arec_set(size_t index, char_T a) noexcept
Definition: all_defs.cpp:17497
float_size_t memory_cost() const noexcept
Definition: all_defs.cpp:17395
string_t arec(size_t index, constexpr_str_t &delimiter_str) const
Definition: all_defs.cpp:17928
size_t find_first_of(const string_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17808
string_t(string_view_t str) noexcept
Definition: all_defs.cpp:17320
size_t size() const noexcept
Definition: all_defs.cpp:17633
string_t & operator=(const string_t &str) noexcept
Definition: all_defs.cpp:17343
size_t reverse_find(const char_T ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17760
constexpr bool starts_with(constexpr_str_t &str) const noexcept
Definition: all_defs.cpp:17986
string_t operator+(const string_t &str) const noexcept
Definition: all_defs.cpp:17350
string_t & operator+=(string_view_t str) &noexcept
Definition: all_defs.cpp:17377
size_t find_last_of(const string_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17856
size_t find_last_of(const arec_t &&ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17871
constexpr auto operator<=>(string_view_t a) const noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:17437
reverse_iterator_t< char_T, iterator_base_t > reverse_iterator
Definition: all_defs.cpp:17692
char_T pop_front() noexcept
Definition: all_defs.cpp:17745
constexpr auto operator<=>(const char_T *a) const noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:17475
const char_T * data() const noexcept
Definition: all_defs.cpp:17629
constexpr bool ends_with(constexpr_str_t &str) const noexcept
Definition: all_defs.cpp:18014
char_T * writeable_data() noexcept
Definition: all_defs.cpp:17630
const_iterator cbegin() const noexcept
Definition: all_defs.cpp:17687
size_t find_first_not_of(char_T ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17844
constexpr auto operator==(const char_T *a) const noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:17481
void push_front(const arec_t &&ch) &noexcept
Definition: all_defs.cpp:17739
size_t find_last_not_of(const arec_t &&ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17895
void resize(size_t nsize) noexcept
Definition: all_defs.cpp:17650
const arec_t front() const noexcept
Definition: all_defs.cpp:17530
size_t find_last_of(constexpr_str_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17853
this_t & append(size_t size, char_T ch) noexcept
Definition: all_defs.cpp:18036
constexpr string_t() noexcept
Definition: all_defs.cpp:17318
size_t find_first_of(const arec_t &&ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17823
size_t length() const noexcept
Definition: all_defs.cpp:17636
size_t find_first_of(constexpr_str_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17805
constexpr auto operator==(constexpr_str_t &a) const noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:17467
constexpr bool starts_with(const char_T *str) const noexcept
Definition: all_defs.cpp:18004
size_t find(string_view_t str, size_t begin=0) const noexcept(find_nothrow)
Definition: all_defs.cpp:17763
iterator get_iterator_at(ptrdiff_t index) noexcept
Definition: all_defs.cpp:17683
friend string_t operator+(char_T ch, const string_t &str) noexcept
Definition: all_defs.cpp:17369
reverse_const_iterator rcbegin() const noexcept
Definition: all_defs.cpp:17699
friend string_t operator+(const char_T *str1, const string_t &str2) noexcept
Definition: all_defs.cpp:17366
size_t reverse_find(const string_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17788
base_t_w::string_view_t string_view_t
Definition: all_defs.cpp:17198
size_t find(constexpr_str_t &str, size_t begin=0) const noexcept(find_nothrow)
Definition: all_defs.cpp:17769
const_iterator_t< char_T, const iterator_base_t > const_iterator
Definition: all_defs.cpp:17681
size_t find_last_not_of(const string_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17880
const floating_arec_t operator[](float_t index) const noexcept
Definition: all_defs.cpp:17602
size_t reverse_find(constexpr_str_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17772
bool empty() const noexcept
Definition: all_defs.cpp:17635
requires ::std::is_arithmetic_v< T > auto operator[](T index) noexcept
Definition: all_defs.cpp:17606
const arec_t operator[](size_t index) const noexcept
Definition: all_defs.cpp:17526
size_t find_first_of(char_T ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17820
string_t & operator+=(const string_t &str) &noexcept
Definition: all_defs.cpp:17373
reverse_const_iterator rbegin() const noexcept
Definition: all_defs.cpp:17698
void push_back(char_T ch) &noexcept
Definition: all_defs.cpp:17720
constexpr bool contains(char_T ch) const noexcept
Definition: all_defs.cpp:17973
string_t(const char_T *str) noexcept
Definition: all_defs.cpp:17321
constexpr bool starts_with(char_T ch) const noexcept
Definition: all_defs.cpp:17999
string_t(size_t size) noexcept
Definition: all_defs.cpp:17337
constexpr auto operator<=>(const string_t &a) const noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:17403
constexpr bool ends_with(const string_t &str) const noexcept
Definition: all_defs.cpp:18019
void insert(size_t pos, const string_t &str) &noexcept
Definition: all_defs.cpp:17943
string_t(char_T ch, size_t size) noexcept
Definition: all_defs.cpp:17335
void push_front(const string_t &str) &noexcept
Definition: all_defs.cpp:17724
size_t find_first_of(const char_T *str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17817
void push_back(const char_T *str) &noexcept
Definition: all_defs.cpp:17722
auto view() const &noexcept
Definition: all_defs.cpp:17752
size_t reverse_find(string_view_t str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17766
string_t< char_T > this_t
Definition: all_defs.cpp:17200
const_iterator end() const noexcept
Definition: all_defs.cpp:17689
reverse_const_iterator get_reverse_iterator_at(ptrdiff_t index) const noexcept
Definition: all_defs.cpp:17696
size_t find_first_not_of(const string_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17832
size_t find_first_not_of(string_view_t str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17826
constexpr bool starts_with(const string_t &str) const noexcept
Definition: all_defs.cpp:17991
string_t(string_t &&str) noexcept
Definition: all_defs.cpp:17331
string_t && operator+(U &&b) &&noexcept(noexcept((*this+=b)))
Definition: all_defs.cpp:17388
constexpr bool contains(const char_T *str) const noexcept
Definition: all_defs.cpp:17976
void push_back(const string_t &str) &noexcept
Definition: all_defs.cpp:17706
iterator_t< char_T, iterator_base_t > iterator
Definition: all_defs.cpp:17680
constexpr auto operator<=>(constexpr_str_t &a) const noexcept(compare.nothrow< char_T >)
Definition: all_defs.cpp:17459
size_t find_first_not_of(constexpr_str_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17829
reverse_const_iterator rend() const noexcept
Definition: all_defs.cpp:17701
void insert(size_t pos, const char_T *str) &noexcept
Definition: all_defs.cpp:17954
arec_t operator[](size_t index) noexcept
Definition: all_defs.cpp:17525
constexpr bool contains(string_view_t str) const noexcept
Definition: all_defs.cpp:17964
string_t pop_front(size_t size) noexcept
Definition: all_defs.cpp:17743
const arec_t back() const noexcept
Definition: all_defs.cpp:17533
void insert(size_t pos, string_view_t str) &noexcept
Definition: all_defs.cpp:17951
iterator begin() noexcept
Definition: all_defs.cpp:17685
char_T * writeable_c_str() noexcept
Definition: all_defs.cpp:17632
size_t find_last_of(string_view_t str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17850
string_t(size_t size, char_T ch) noexcept
Definition: all_defs.cpp:17334
floating_arec_t operator[](float_t index) noexcept
Definition: all_defs.cpp:17601
size_t find_first_not_of(const arec_t &&ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17847
base_string_data_t< char_T > base_t_w
Definition: all_defs.cpp:17196
string_t arec(size_t index, char_T delimiter) const
Definition: all_defs.cpp:17901
void erase(size_t pos, size_t size=1) &noexcept
Definition: all_defs.cpp:17940
iterator end() noexcept
Definition: all_defs.cpp:17688
reverse_iterator rbegin() noexcept
Definition: all_defs.cpp:17697
void resize(size_t nsize, char_T ch) noexcept
Definition: all_defs.cpp:17637
string_t operator+(const arec_t &&ch) const noexcept
Definition: all_defs.cpp:17536
constexpr bool contains(constexpr_str_t &str) const noexcept
Definition: all_defs.cpp:17967
string_t arec(size_t index, const string_t &delimiter_str) const
Definition: all_defs.cpp:17919
void push_front(const char_T *str) &noexcept
Definition: all_defs.cpp:17740
size_t find_first_of(string_view_t str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17802
size_t find_last_not_of(char_T ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17892
string_t & operator+=(const arec_t &&ch) &noexcept
Definition: all_defs.cpp:17539
char_T arec(size_t index) noexcept
Definition: all_defs.cpp:17491
string_t substr(size_t begin, size_t size=npos) const noexcept
Definition: all_defs.cpp:17620
const constexpr_str_t< char_T > constexpr_str_t
Definition: all_defs.cpp:17199
void swap_with(this_t &a) noexcept
Definition: all_defs.cpp:17308
string_t pop_back(size_t size) noexcept
Definition: all_defs.cpp:17742
void insert(size_t pos, char_T ch) &noexcept
Definition: all_defs.cpp:17957
reverse_const_iterator rcend() const noexcept
Definition: all_defs.cpp:17702
string_t arec(size_t index, string_view_t delimiter_str) const
Definition: all_defs.cpp:17910
requires ::std::is_arithmetic_v< T > const auto operator[](T index) const noexcept
Definition: all_defs.cpp:17613
size_t find_last_not_of(string_view_t str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17874
string_t & operator+=(char_T ch) &noexcept
Definition: all_defs.cpp:17384
size_t find_last_of(const char_T *str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17865
size_t find_last_not_of(constexpr_str_t &str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17877
constexpr auto operator==(string_view_t a) const noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:17448
constexpr bool contains(const string_t &str) const noexcept
Definition: all_defs.cpp:17970
char_T pop_back() noexcept
Definition: all_defs.cpp:17744
void push_back(const arec_t &&ch) &noexcept
Definition: all_defs.cpp:17721
const_iterator get_iterator_at(ptrdiff_t index) const noexcept
Definition: all_defs.cpp:17684
void push_back(string_view_t str) &noexcept
Definition: all_defs.cpp:17719
string_t & operator+=(const char_T *str) &noexcept
Definition: all_defs.cpp:17381
constexpr bool ends_with(char_T ch) const noexcept
Definition: all_defs.cpp:18027
constexpr bool ends_with(string_view_t str) const noexcept
Definition: all_defs.cpp:18009
size_t find_first_not_of(const char_T *str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17841
constexpr bool starts_with(string_view_t str) const noexcept
Definition: all_defs.cpp:17981
const_iterator begin() const noexcept
Definition: all_defs.cpp:17686
string_t operator+(const char_T *str) const noexcept
Definition: all_defs.cpp:17360
string_t operator+(string_view_t str) const noexcept
Definition: all_defs.cpp:17357
void push_front(char_T ch) &noexcept
Definition: all_defs.cpp:17738
string_t(const string_t &str) noexcept
Definition: all_defs.cpp:17323
size_t find_last_of(char_T ch) const noexcept(find_nothrow)
Definition: all_defs.cpp:17868
const char_T * c_str() const noexcept
Definition: all_defs.cpp:17631
size_t find(const char_T ch, size_t begin=0) const noexcept(find_nothrow)
Definition: all_defs.cpp:17757
auto to_string_view_t() const &noexcept
Definition: all_defs.cpp:17750
const_iterator cend() const noexcept
Definition: all_defs.cpp:17690
reverse_iterator rend() noexcept
Definition: all_defs.cpp:17700
friend string_t operator+(string_view_t str1, const string_t &str2) noexcept
Definition: all_defs.cpp:17363
constexpr string_t(char_T ch) noexcept
Definition: all_defs.cpp:17322
reverse_iterator get_reverse_iterator_at(ptrdiff_t index) noexcept
Definition: all_defs.cpp:17695
constexpr string_t & operator=(char_T ch) noexcept
Definition: all_defs.cpp:17346
constexpr auto operator==(const string_t &a) const noexcept(equal.nothrow< char_T >)
Definition: all_defs.cpp:17420
constexpr string_t(constexpr_str_t &str) noexcept
Definition: all_defs.cpp:17319
size_t find_last_not_of(const char_T *str) const noexcept(find_nothrow)
Definition: all_defs.cpp:17889
reverse_const_iterator_t< char_T, const iterator_base_t > reverse_const_iterator
Definition: all_defs.cpp:17693
constexpr string_t & operator=(constexpr_str_t &str) noexcept
Definition: all_defs.cpp:17345